remove 5G dependency on 4G mac.h include, separate RA state enums between 4G/5G and UE/gNB
add RA stat trace by enum name instead of integer printing fix minor a few minor typos
This commit is contained in:
@@ -108,8 +108,7 @@ add_msg3(module_id_t module_idP, int CC_id, RA_t *ra, frame_t frameP,
|
||||
uint8_t pusch_maxNumRepetitionCEmodeA_r13;
|
||||
ul_req = &mac->UL_req_tmp[CC_id][ra->Msg3_subframe];
|
||||
ul_req_body = &ul_req->ul_config_request_body;
|
||||
AssertFatal(ra->state != IDLE, "RA is not active for RA %X\n",
|
||||
ra->rnti);
|
||||
AssertFatal(ra->eRA_state != IDLE, "RA is not active for RA %X\n", ra->rnti);
|
||||
|
||||
if (ra->rach_resource_type > 0) {
|
||||
LOG_D (MAC, "[eNB %d][RAPROC] Frame %d, Subframe %d : CC_id %d CE level %d is active, Msg3 in (%d,%d)\n",
|
||||
@@ -448,7 +447,7 @@ void generate_Msg2(module_id_t module_idP,
|
||||
/* Program UL processing for Msg3, same as regular LTE */
|
||||
get_Msg3alloc (&cc[CC_idP], subframeP, frameP, &ra->Msg3_frame, &ra->Msg3_subframe);
|
||||
add_msg3 (module_idP, CC_idP, ra, frameP, subframeP);
|
||||
ra->state = WAITMSG3;
|
||||
ra->eRA_state = WAITMSG3;
|
||||
/* DL request */
|
||||
LOG_D(MAC, "[eNB %d][RAPROC] Frame %d, Subframe %d : In generate_Msg2, Programming TX Req\n",
|
||||
module_idP,
|
||||
@@ -467,8 +466,12 @@ void generate_Msg2(module_id_t module_idP,
|
||||
} else {
|
||||
if ((ra->Msg2_frame == frameP) && (ra->Msg2_subframe == subframeP)) {
|
||||
LOG_D(MAC,
|
||||
"[eNB %d] CC_id %d Frame %d, subframeP %d: Generating RAR DCI, state %d\n",
|
||||
module_idP, CC_idP, frameP, subframeP, ra->state);
|
||||
"[eNB %d] CC_id %d Frame %d, subframeP %d: Generating RAR DCI, state %s\n",
|
||||
module_idP,
|
||||
CC_idP,
|
||||
frameP,
|
||||
subframeP,
|
||||
era_text[ra->eRA_state]);
|
||||
// Allocate 4 PRBS starting in RB 0
|
||||
first_rb = 0;
|
||||
vrb_map[first_rb] = 1;
|
||||
@@ -537,7 +540,7 @@ void generate_Msg2(module_id_t module_idP,
|
||||
ra->Msg3_subframe);
|
||||
fill_rar(module_idP, CC_idP, ra, frameP, cc[CC_idP].RAR_pdu.payload, N_RB_DL, 7);
|
||||
add_msg3(module_idP, CC_idP, ra, frameP, subframeP);
|
||||
ra->state = WAITMSG3;
|
||||
ra->eRA_state = WAITMSG3;
|
||||
LOG_D(MAC,"[eNB %d][RAPROC] Frame %d, Subframe %d: state:WAITMSG3\n", module_idP, frameP, subframeP);
|
||||
T(T_ENB_MAC_UE_DL_RAR_PDU_WITH_DATA, T_INT(module_idP),
|
||||
T_INT(CC_idP), T_INT(ra->RA_rnti), T_INT(frameP),
|
||||
@@ -819,7 +822,7 @@ generate_Msg4(module_id_t module_idP,
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.initial_transmission_sf_io = (10 * frameP) + subframeP;
|
||||
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.drms_table_flag = 0;
|
||||
dl_req_body->number_pdu++;
|
||||
ra->state = WAITMSG4ACK;
|
||||
ra->eRA_state = WAITMSG4ACK;
|
||||
lcid = 0;
|
||||
UE_info->UE_sched_ctrl[UE_id].round[CC_idP][ra->harq_pid] = 0;
|
||||
msg4_header = 1 + 6 + 1; // CR header, CR CE, SDU header
|
||||
@@ -975,7 +978,7 @@ generate_Msg4(module_id_t module_idP,
|
||||
dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.aggregation_level, ra->rnti)) {
|
||||
dl_req_body->number_dci++;
|
||||
dl_req_body->number_pdu++;
|
||||
ra->state = WAITMSG4ACK;
|
||||
ra->eRA_state = WAITMSG4ACK;
|
||||
LOG_D(MAC,"[eNB %d][RAPROC] Frame %d, Subframe %d: state:WAITMSG4ACK\n", module_idP, frameP, subframeP);
|
||||
// increment Absolute subframe by 8 for Msg4 retransmission
|
||||
LOG_D(MAC,
|
||||
@@ -1219,7 +1222,7 @@ check_Msg4_retransmission(module_id_t module_idP, int CC_idP,
|
||||
LOG_D(MAC,
|
||||
"[eNB %d][RAPROC] CC_id %d Frame %d, subframeP %d : Msg4 acknowledged\n",
|
||||
module_idP, CC_idP, frameP, subframeP);
|
||||
ra->state = IDLE;
|
||||
ra->eRA_state = IDLE;
|
||||
LOG_D(MAC,"[eNB %d][RAPROC] Frame %d, Subframe %d: state:IDLE\n", module_idP, frameP, subframeP);
|
||||
UE_id = find_UE_id(module_idP, ra->rnti);
|
||||
DevAssert(UE_id != -1);
|
||||
@@ -1246,11 +1249,11 @@ schedule_RA(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP) {
|
||||
for (i = 0; i < NB_RA_PROC_MAX; i++) {
|
||||
ra = (RA_t *) & cc[CC_id].ra[i];
|
||||
|
||||
if (ra->state == MSG2)
|
||||
if (ra->eRA_state == MSG2)
|
||||
generate_Msg2(module_idP, CC_id, frameP, subframeP, ra);
|
||||
else if (ra->state == MSG4 && ra->Msg4_frame == frameP && ra->Msg4_subframe == subframeP )
|
||||
else if (ra->eRA_state == MSG4 && ra->Msg4_frame == frameP && ra->Msg4_subframe == subframeP)
|
||||
generate_Msg4(module_idP, CC_id, frameP, subframeP, ra);
|
||||
else if (ra->state == WAITMSG4ACK)
|
||||
else if (ra->eRA_state == WAITMSG4ACK)
|
||||
check_Msg4_retransmission(module_idP, CC_id, frameP,
|
||||
subframeP, ra);
|
||||
} // for i=0 .. N_RA_PROC-1
|
||||
@@ -1309,11 +1312,11 @@ initiate_ra_proc(module_id_t module_idP,
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_INITIATE_RA_PROC, 0);
|
||||
|
||||
for (i = 0; i < NB_RA_PROC_MAX; i++) {
|
||||
if (ra[i].state == IDLE) {
|
||||
if (ra[i].eRA_state == IDLE) {
|
||||
int loop = 0;
|
||||
LOG_D(MAC, "Frame %d, Subframe %d: Activating RA process %d\n",
|
||||
frameP, subframeP, i);
|
||||
ra[i].state = MSG2;
|
||||
ra[i].eRA_state = MSG2;
|
||||
ra[i].Msg4_delay_cnt=0;
|
||||
ra[i].timing_offset = timing_offset;
|
||||
ra[i].preamble_subframe = subframeP;
|
||||
@@ -1410,7 +1413,8 @@ initiate_ra_proc(module_id_t module_idP,
|
||||
ra[i].preamble_index = preamble_index;
|
||||
failure_cnt = 0;
|
||||
LOG_I(MAC,
|
||||
"[eNB %d][RAPROC] CC_id %d Frame %d Activating RAR generation in Frame %d, subframe %d for process %d, rnti %x, state %d\n",
|
||||
"[eNB %d][RAPROC] CC_id %d Frame %d Activating RAR generation in Frame %d, subframe %d for process %d, rnti %x, state "
|
||||
"%d\n",
|
||||
module_idP,
|
||||
CC_id,
|
||||
frameP,
|
||||
@@ -1418,7 +1422,7 @@ initiate_ra_proc(module_id_t module_idP,
|
||||
ra[i].Msg2_subframe,
|
||||
i,
|
||||
ra[i].rnti,
|
||||
ra[i].state);
|
||||
ra[i].eRA_state);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -1445,7 +1449,7 @@ cancel_ra_proc(module_id_t module_idP, int CC_id, frame_t frameP,
|
||||
|
||||
for (i = 0; i < NB_RA_PROC_MAX; i++) {
|
||||
if (rnti == ra[i].rnti) {
|
||||
ra[i].state = IDLE;
|
||||
ra[i].eRA_state = IDLE;
|
||||
ra[i].timing_offset = 0;
|
||||
ra[i].RRC_timer = 20;
|
||||
ra[i].rnti = 0;
|
||||
@@ -1461,7 +1465,7 @@ void clear_ra_proc(module_id_t module_idP, int CC_id, frame_t frameP) {
|
||||
|
||||
for (i = 0; i < NB_RA_PROC_MAX; i++) {
|
||||
LOG_D(MAC,"[eNB %d][RAPROC] CC_id %d Frame %d Clear Random access information rnti %x\n", module_idP, CC_id, frameP, ra[i].rnti);
|
||||
ra[i].state = IDLE;
|
||||
ra[i].eRA_state = IDLE;
|
||||
ra[i].timing_offset = 0;
|
||||
ra[i].RRC_timer = 20;
|
||||
ra[i].rnti = 0;
|
||||
|
||||
@@ -428,11 +428,11 @@ void check_ra_rnti_mui(module_id_t mod_id, int CC_id, frame_t f, sub_frame_t sf,
|
||||
int harq_pid = frame_subframe2_dl_harq_pid(tdd_config, f, sf);
|
||||
RA_t *ra = &RC.mac[mod_id]->common_channels[CC_id].ra[0];
|
||||
for (uint8_t ra_ii = 0; ra_ii < NB_RA_PROC_MAX; ra_ii++, ra++) {
|
||||
if ((ra->rnti == rnti) && (ra->state == MSGCRNTI)) {
|
||||
if ((ra->rnti == rnti) && (ra->eRA_state == MSGCRNTI)) {
|
||||
for (uint16_t mui_num = 0; mui_num < rlc_am_mui.rrc_mui_num; mui_num++) {
|
||||
if (ra->crnti_rrc_mui == rlc_am_mui.rrc_mui[mui_num]) {
|
||||
ra->crnti_harq_pid = harq_pid;
|
||||
ra->state = MSGCRNTI_ACK;
|
||||
ra->eRA_state = MSGCRNTI_ACK;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1583,11 +1583,11 @@ schedule_ue_spec_fairRR(module_id_t module_idP,
|
||||
RA_t *ra = &eNB->common_channels[CC_id].ra[0];
|
||||
|
||||
for (uint8_t ra_ii = 0; ra_ii < NB_RA_PROC_MAX; ra_ii++) {
|
||||
if((ra[ra_ii].rnti == rnti) && (ra[ra_ii].state == MSGCRNTI)) {
|
||||
if ((ra[ra_ii].rnti == rnti) && (ra[ra_ii].eRA_state == MSGCRNTI)) {
|
||||
for(uint16_t mui_num = 0; mui_num < rlc_am_mui.rrc_mui_num; mui_num++) {
|
||||
if(ra[ra_ii].crnti_rrc_mui == rlc_am_mui.rrc_mui[mui_num]) {
|
||||
ra[ra_ii].crnti_harq_pid = harq_pid;
|
||||
ra[ra_ii].state = MSGCRNTI_ACK;
|
||||
ra[ra_ii].eRA_state = MSGCRNTI_ACK;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -2869,7 +2869,7 @@ schedule_ulsch_fairRR(module_id_t module_idP, frame_t frameP,
|
||||
// Msg3 is using 1 PRB so we need to increase first_rb accordingly
|
||||
// not sure about the break (can there be more than 1 active RA procedure?)
|
||||
for (i=0; i<NB_RA_PROC_MAX; i++) {
|
||||
if ((cc->ra[i].state == WAITMSG3) &&(cc->ra[i].Msg3_subframe == sched_subframe)) {
|
||||
if ((cc->ra[i].eRA_state == WAITMSG3) && (cc->ra[i].Msg3_subframe == sched_subframe)) {
|
||||
ulsch_ue_select[CC_id].list[ulsch_ue_select[CC_id].ue_num].ue_priority = SCH_UL_MSG3;
|
||||
|
||||
if (cc->tdd_Config == NULL) {
|
||||
|
||||
@@ -2005,12 +2005,9 @@ find_RA_id(module_id_t mod_idP,
|
||||
RA_t *ra = (RA_t *) &RC.mac[mod_idP]->common_channels[CC_idP].ra[0];
|
||||
|
||||
for (RA_id = 0; RA_id < NB_RA_PROC_MAX; RA_id++) {
|
||||
LOG_D(MAC, "Checking RA_id %d for %x : state %d\n",
|
||||
RA_id,
|
||||
rntiP,
|
||||
ra[RA_id].state);
|
||||
LOG_D(MAC, "Checking RA_id %d for %x : state %s\n", RA_id, rntiP, era_text[ra[RA_id].eRA_state]);
|
||||
|
||||
if (ra[RA_id].state != IDLE && ra[RA_id].rnti == rntiP)
|
||||
if (ra[RA_id].eRA_state != IDLE && ra[RA_id].rnti == rntiP)
|
||||
return RA_id;
|
||||
}
|
||||
|
||||
@@ -3970,7 +3967,7 @@ extract_harq(module_id_t mod_idP,
|
||||
|
||||
if (sched_ctl->round[CC_idP][harq_pid] == 8) {
|
||||
for (uint8_t ra_i = 0; ra_i < NB_RA_PROC_MAX; ra_i++) {
|
||||
if (ra[ra_i].rnti == rnti && ra[ra_i].state == WAITMSG4ACK) {
|
||||
if (ra[ra_i].rnti == rnti && ra[ra_i].eRA_state == WAITMSG4ACK) {
|
||||
//Msg NACK num to MAC ,remove UE
|
||||
// add UE info to freeList
|
||||
LOG_I(RRC, "put UE %x into freeList\n",
|
||||
@@ -3985,7 +3982,7 @@ extract_harq(module_id_t mod_idP,
|
||||
}
|
||||
|
||||
for (uint8_t ra_i = 0; ra_i < NB_RA_PROC_MAX; ra_i++) {
|
||||
if (ra[ra_i].rnti == rnti && ra[ra_i].state == MSGCRNTI_ACK && ra[ra_i].crnti_harq_pid == harq_pid) {
|
||||
if (ra[ra_i].rnti == rnti && ra[ra_i].eRA_state == MSGCRNTI_ACK && ra[ra_i].crnti_harq_pid == harq_pid) {
|
||||
LOG_D(MAC,"CRNTI Reconfiguration: ACK %d rnti %x round %d frame %d subframe %d \n",
|
||||
harq_indication_tdd->harq_data[0].bundling.value_0,
|
||||
rnti,
|
||||
@@ -4077,7 +4074,7 @@ extract_harq(module_id_t mod_idP,
|
||||
RA_t *ra = &eNB->common_channels[CC_idP].ra[0];
|
||||
|
||||
for (uint8_t ra_i = 0; ra_i < NB_RA_PROC_MAX; ra_i++) {
|
||||
if (ra[ra_i].rnti == rnti && ra[ra_i].state == MSGCRNTI_ACK && ra[ra_i].crnti_harq_pid == harq_pid) {
|
||||
if (ra[ra_i].rnti == rnti && ra[ra_i].eRA_state == MSGCRNTI_ACK && ra[ra_i].crnti_harq_pid == harq_pid) {
|
||||
LOG_D(MAC,"CRNTI Reconfiguration: ACK %d rnti %x round %d frame %d subframe %d \n",
|
||||
pdu[0],
|
||||
rnti,
|
||||
@@ -4122,7 +4119,7 @@ extract_harq(module_id_t mod_idP,
|
||||
|
||||
if (sched_ctl->round[CC_idP][harq_pid] == 8) {
|
||||
for (uint8_t ra_i = 0; ra_i < NB_RA_PROC_MAX; ra_i++) {
|
||||
if((ra[ra_i].rnti == rnti) && (ra[ra_i].state == WAITMSG4ACK)) {
|
||||
if ((ra[ra_i].rnti == rnti) && (ra[ra_i].eRA_state == WAITMSG4ACK)) {
|
||||
// Msg NACK num to MAC ,remove UE
|
||||
// add UE info to freeList
|
||||
LOG_I(RRC, "put UE %x into freeList\n",
|
||||
|
||||
@@ -522,7 +522,7 @@ rx_sdu(const module_id_t enb_mod_idP,
|
||||
|
||||
/* Received a new rnti */
|
||||
if (ret == 0) {
|
||||
ra->state = MSGCRNTI;
|
||||
ra->eRA_state = MSGCRNTI;
|
||||
LOG_I(MAC, "[eNB %d] Frame %d, Subframe %d CC_id %d : (rnti %x UE_id %d) Received rnti(Msg4)\n",
|
||||
enb_mod_idP,
|
||||
frameP,
|
||||
@@ -729,13 +729,14 @@ rx_sdu(const module_id_t enb_mod_idP,
|
||||
|
||||
if (RA_id != -1) {
|
||||
RA_t *ra = &(mac->common_channels[CC_idP].ra[RA_id]);
|
||||
LOG_D(MAC, "[mac %d][RAPROC] CC_id %d Checking proc %d : rnti (%x, %x), state %d\n",
|
||||
LOG_D(MAC,
|
||||
"[mac %d][RAPROC] CC_id %d Checking proc %d : rnti (%x, %x), state %s\n",
|
||||
enb_mod_idP,
|
||||
CC_idP,
|
||||
RA_id,
|
||||
ra->rnti,
|
||||
current_rnti,
|
||||
ra->state);
|
||||
era_text[ra->eRA_state]);
|
||||
|
||||
if (UE_id < 0) {
|
||||
memcpy(&(ra->cont_res_id[0]), payload_ptr, 6);
|
||||
@@ -788,7 +789,7 @@ rx_sdu(const module_id_t enb_mod_idP,
|
||||
}
|
||||
|
||||
// prepare transmission of Msg4
|
||||
ra->state = MSG4;
|
||||
ra->eRA_state = MSG4;
|
||||
|
||||
if(mac->common_channels[CC_idP].tdd_Config != NULL) {
|
||||
switch(mac->common_channels[CC_idP].tdd_Config->subframeAssignment) {
|
||||
|
||||
@@ -505,7 +505,9 @@ typedef struct {
|
||||
} __attribute__ ((__packed__)) ULDCH_PDU;
|
||||
|
||||
/*!\brief RA process state*/
|
||||
typedef enum { IDLE = 0, MSG2, WAITMSG3, MSG4, WAITMSG4ACK, MSGCRNTI, MSGCRNTI_ACK } RA_state;
|
||||
typedef enum { IDLE = 0, MSG2, WAITMSG3, MSG4, WAITMSG4ACK, MSGCRNTI, MSGCRNTI_ACK } eRA_state;
|
||||
static const char *const era_text[] = {"IDLE", "Ms2", "WAITMSG3", "WAITMSG4ACK", "MSGCRNTI", "MSGCRNTIACK"};
|
||||
|
||||
/*!\brief UE DLSCH scheduling states*/
|
||||
typedef enum { S_DL_NONE = 0, S_DL_SCHEDULED } UE_DLSCH_STATUS;
|
||||
/*!\brief scheduler mode */
|
||||
@@ -1032,7 +1034,7 @@ typedef struct {
|
||||
/*! \brief eNB template for the Random access information */
|
||||
typedef struct {
|
||||
/// Flag to indicate this process is active
|
||||
RA_state state;
|
||||
eRA_state eRA_state;
|
||||
/// Subframe where preamble was received
|
||||
uint8_t preamble_subframe;
|
||||
/// Subframe where Msg2 is to be sent
|
||||
|
||||
Reference in New Issue
Block a user