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:
@@ -39,6 +39,7 @@
|
||||
|
||||
#include "PHY/defs_eNB.h"
|
||||
#include "PHY/LTE_TRANSPORT/transport_proto.h"
|
||||
#include "openair2/LAYER2/MAC/mac.h"
|
||||
#include "openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h"
|
||||
#include "executables/lte-softmodem.h"
|
||||
#include "openair1/PHY/defs_gNB.h"
|
||||
@@ -46,7 +47,6 @@
|
||||
#include "common/ran_context.h"
|
||||
#include "openair2/PHY_INTERFACE/queue_t.h"
|
||||
#include "gnb_ind_vars.h"
|
||||
#include "LAYER2/MAC/mac.h"
|
||||
|
||||
#define TEST
|
||||
|
||||
|
||||
@@ -873,7 +873,7 @@ int main(int argc, char **argv)
|
||||
asn1cFreeStruc(asn_DEF_NR_CellGroupConfig, UE_CellGroup);
|
||||
|
||||
UE_mac->state = UE_CONNECTED;
|
||||
UE_mac->ra.ra_state = RA_SUCCEEDED;
|
||||
UE_mac->ra.ra_state = nrRA_SUCCEEDED;
|
||||
|
||||
nr_phy_data_t phy_data = {0};
|
||||
fapi_nr_dl_config_request_t dl_config = {.sfn = frame, .slot = slot};
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1442,7 +1442,7 @@ static void handle_reconfiguration_with_sync(NR_UE_MAC_INST_t *mac,
|
||||
}
|
||||
|
||||
mac->state = UE_NOT_SYNC;
|
||||
ra->ra_state = RA_UE_IDLE;
|
||||
ra->ra_state = nrRA_UE_IDLE;
|
||||
nr_ue_mac_default_configs(mac);
|
||||
|
||||
if (!get_softmodem_params()->emulate_l1) {
|
||||
|
||||
@@ -238,13 +238,16 @@ typedef struct {
|
||||
} NR_UE_SCHEDULING_INFO;
|
||||
|
||||
typedef enum {
|
||||
RA_UE_IDLE = 0,
|
||||
GENERATE_PREAMBLE = 1,
|
||||
WAIT_RAR = 2,
|
||||
WAIT_CONTENTION_RESOLUTION = 3,
|
||||
RA_SUCCEEDED = 4,
|
||||
RA_FAILED = 5
|
||||
} RA_state_t;
|
||||
nrRA_UE_IDLE = 0,
|
||||
nrRA_GENERATE_PREAMBLE = 1,
|
||||
nrRA_WAIT_RAR = 2,
|
||||
nrRA_WAIT_CONTENTION_RESOLUTION = 3,
|
||||
nrRA_SUCCEEDED = 4,
|
||||
nrRA_FAILED = 5
|
||||
} nrRA_UE_state_t;
|
||||
|
||||
static const char *const nrra_ue_text[] =
|
||||
{"UE_IDLE", "GENERATE_PREAMBLE", "WAIT_RAR", "WAIT_CONTENTION_RESOLUTION", "RA_SUCCEEDED", "RA_FAILED"};
|
||||
|
||||
typedef struct {
|
||||
/// PRACH format retrieved from prach_ConfigIndex
|
||||
@@ -276,7 +279,7 @@ typedef struct {
|
||||
// pointer to RACH config dedicated
|
||||
NR_RACH_ConfigDedicated_t *rach_ConfigDedicated;
|
||||
/// state of RA procedure
|
||||
RA_state_t ra_state;
|
||||
nrRA_UE_state_t ra_state;
|
||||
/// RA contention type
|
||||
uint8_t cfra;
|
||||
/// RA rx frame offset: compensate RA rx offset introduced by OAI gNB.
|
||||
|
||||
@@ -161,8 +161,8 @@ void reset_mac_inst(NR_UE_MAC_INST_t *nr_mac)
|
||||
nr_mac->ul_harq_info[k].last_ndi = -1; // initialize to invalid value
|
||||
|
||||
// stop any ongoing RACH procedure
|
||||
if (nr_mac->ra.ra_state < RA_SUCCEEDED)
|
||||
nr_mac->ra.ra_state = RA_UE_IDLE;
|
||||
if (nr_mac->ra.ra_state < nrRA_SUCCEEDED)
|
||||
nr_mac->ra.ra_state = nrRA_UE_IDLE;
|
||||
|
||||
// discard explicitly signalled contention-free Random Access Resources
|
||||
// TODO not sure what needs to be done here
|
||||
|
||||
@@ -563,7 +563,7 @@ void nr_get_prach_resources(NR_UE_MAC_INST_t *mac,
|
||||
void nr_Msg1_transmitted(NR_UE_MAC_INST_t *mac)
|
||||
{
|
||||
RA_config_t *ra = &mac->ra;
|
||||
ra->ra_state = WAIT_RAR;
|
||||
ra->ra_state = nrRA_WAIT_RAR;
|
||||
ra->RA_attempt_number++;
|
||||
}
|
||||
|
||||
@@ -580,7 +580,7 @@ void nr_Msg3_transmitted(NR_UE_MAC_INST_t *mac, uint8_t CC_id, frame_t frameP, s
|
||||
nr_timer_setup(&ra->contention_resolution_timer, RA_contention_resolution_timer_subframes * subframes_per_slot, 1);
|
||||
nr_timer_start(&ra->contention_resolution_timer);
|
||||
|
||||
ra->ra_state = WAIT_CONTENTION_RESOLUTION;
|
||||
ra->ra_state = nrRA_WAIT_CONTENTION_RESOLUTION;
|
||||
}
|
||||
|
||||
void nr_get_msg3_payload(NR_UE_MAC_INST_t *mac, uint8_t *buf, int TBS_max)
|
||||
@@ -645,10 +645,10 @@ void nr_ue_get_rach(NR_UE_MAC_INST_t *mac, int CC_id, frame_t frame, uint8_t gNB
|
||||
NR_PRACH_RESOURCES_t *prach_resources = &ra->prach_resources;
|
||||
|
||||
// Delay init RA procedure to allow the convergence of the IIR filter on PRACH noise measurements at gNB side
|
||||
if (ra->ra_state == RA_UE_IDLE) {
|
||||
if (ra->ra_state == nrRA_UE_IDLE) {
|
||||
if ((mac->first_sync_frame > -1 || get_softmodem_params()->do_ra || get_softmodem_params()->nsa) &&
|
||||
((MAX_FRAME_NUMBER + frame - mac->first_sync_frame) % MAX_FRAME_NUMBER) > 150) {
|
||||
ra->ra_state = GENERATE_PREAMBLE;
|
||||
ra->ra_state = nrRA_GENERATE_PREAMBLE;
|
||||
} else {
|
||||
LOG_D(NR_MAC,"PRACH Condition not met: ra state %d, frame %d, sync_frame %d\n", ra->ra_state, frame, mac->first_sync_frame);
|
||||
return;
|
||||
@@ -657,8 +657,7 @@ void nr_ue_get_rach(NR_UE_MAC_INST_t *mac, int CC_id, frame_t frame, uint8_t gNB
|
||||
|
||||
LOG_D(NR_MAC, "[UE %d][%d.%d]: ra_state %d, RA_active %d\n", mac->ue_id, frame, nr_slot_tx, ra->ra_state, ra->RA_active);
|
||||
|
||||
if (ra->ra_state > RA_UE_IDLE && ra->ra_state < RA_SUCCEEDED) {
|
||||
|
||||
if (ra->ra_state > nrRA_UE_IDLE && ra->ra_state < nrRA_SUCCEEDED) {
|
||||
if (ra->RA_active == 0) {
|
||||
NR_RACH_ConfigCommon_t *setup = mac->current_UL_BWP->rach_ConfigCommon;
|
||||
NR_RACH_ConfigGeneric_t *rach_ConfigGeneric = &setup->rach_ConfigGeneric;
|
||||
@@ -726,7 +725,7 @@ void nr_ue_get_rach(NR_UE_MAC_INST_t *mac, int CC_id, frame_t frame, uint8_t gNB
|
||||
|
||||
// Fill in preamble and PRACH resources
|
||||
ra->RA_window_cnt--;
|
||||
if (ra->ra_state == GENERATE_PREAMBLE) {
|
||||
if (ra->ra_state == nrRA_GENERATE_PREAMBLE) {
|
||||
nr_get_prach_resources(mac, CC_id, gNB_id, prach_resources, rach_ConfigDedicated);
|
||||
}
|
||||
} else if (ra->RA_backoff_cnt > 0) {
|
||||
@@ -735,7 +734,7 @@ void nr_ue_get_rach(NR_UE_MAC_INST_t *mac, int CC_id, frame_t frame, uint8_t gNB
|
||||
|
||||
ra->RA_backoff_cnt--;
|
||||
|
||||
if ((ra->RA_backoff_cnt > 0 && ra->ra_state == GENERATE_PREAMBLE) || ra->RA_backoff_cnt == 0) {
|
||||
if ((ra->RA_backoff_cnt > 0 && ra->ra_state == nrRA_GENERATE_PREAMBLE) || ra->RA_backoff_cnt == 0) {
|
||||
nr_get_prach_resources(mac, CC_id, gNB_id, prach_resources, rach_ConfigDedicated);
|
||||
}
|
||||
}
|
||||
@@ -828,7 +827,7 @@ void nr_ra_succeeded(NR_UE_MAC_INST_t *mac, const uint8_t gNB_index, const frame
|
||||
|
||||
LOG_D(MAC, "[UE %d] clearing RA_active flag...\n", mac->ue_id);
|
||||
ra->RA_active = 0;
|
||||
ra->ra_state = RA_SUCCEEDED;
|
||||
ra->ra_state = nrRA_SUCCEEDED;
|
||||
mac->state = UE_CONNECTED;
|
||||
free_and_zero(ra->Msg3_buffer);
|
||||
nr_mac_rrc_ra_ind(mac->ue_id, frame, true);
|
||||
@@ -854,7 +853,7 @@ void nr_ra_failed(NR_UE_MAC_INST_t *mac, uint8_t CC_id, NR_PRACH_RESOURCES_t *pr
|
||||
|
||||
ra->first_Msg3 = true;
|
||||
ra->ra_PreambleIndex = -1;
|
||||
ra->ra_state = RA_UE_IDLE;
|
||||
ra->ra_state = nrRA_UE_IDLE;
|
||||
|
||||
prach_resources->RA_PREAMBLE_TRANSMISSION_COUNTER++;
|
||||
|
||||
|
||||
@@ -160,7 +160,7 @@ void config_dci_pdu(NR_UE_MAC_INST_t *mac,
|
||||
rel15->coreset.pdcch_dmrs_scrambling_id = mac->physCellId;
|
||||
}
|
||||
|
||||
rel15->num_dci_options = (mac->ra.ra_state == WAIT_RAR || rnti_type == TYPE_SI_RNTI_) ? 1 : 2;
|
||||
rel15->num_dci_options = (mac->ra.ra_state == nrRA_WAIT_RAR || rnti_type == TYPE_SI_RNTI_) ? 1 : 2;
|
||||
|
||||
if (ss->searchSpaceType->present == NR_SearchSpace__searchSpaceType_PR_ue_Specific) {
|
||||
if (ss->searchSpaceType->choice.ue_Specific->dci_Formats ==
|
||||
@@ -406,11 +406,11 @@ bool is_ss_monitor_occasion(const int frame, const int slot, const int slots_per
|
||||
return monitor;
|
||||
}
|
||||
|
||||
bool monitior_dci_for_other_SI(NR_UE_MAC_INST_t *mac,
|
||||
const NR_SearchSpace_t *ss,
|
||||
const int slots_per_frame,
|
||||
const int frame,
|
||||
const int slot)
|
||||
bool monitor_dci_for_other_SI(NR_UE_MAC_INST_t *mac,
|
||||
const NR_SearchSpace_t *ss,
|
||||
const int slots_per_frame,
|
||||
const int frame,
|
||||
const int slot)
|
||||
{
|
||||
const struct NR_SI_SchedulingInfo *si_SchedulingInfo = mac->si_SchedulingInfo;
|
||||
// 5.2.2.3.2 in 331
|
||||
@@ -508,20 +508,18 @@ void ue_dci_configuration(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_request_t *dl
|
||||
// are same as PDCCH monitoring occasions for SIB1
|
||||
const NR_SearchSpace_t *ss = pdcch_config->otherSI_SS ? pdcch_config->otherSI_SS : mac->search_space_zero;
|
||||
// TODO configure SI-window
|
||||
if (monitior_dci_for_other_SI(mac, ss, slots_per_frame, frame, slot)) {
|
||||
if (monitor_dci_for_other_SI(mac, ss, slots_per_frame, frame, slot)) {
|
||||
LOG_D(NR_MAC_DCI, "Monitoring DCI for other SIs in frame %d slot %d\n", frame, slot);
|
||||
config_dci_pdu(mac, dl_config, TYPE_SI_RNTI_, slot, ss);
|
||||
}
|
||||
}
|
||||
if (mac->state == UE_PERFORMING_RA &&
|
||||
mac->ra.ra_state >= WAIT_RAR) {
|
||||
if (mac->state == UE_PERFORMING_RA && mac->ra.ra_state >= nrRA_WAIT_RAR) {
|
||||
// if RA is ongoing use RA search space
|
||||
if (is_ss_monitor_occasion(frame, slot, slots_per_frame, pdcch_config->ra_SS)) {
|
||||
int rnti_type = mac->ra.ra_state == WAIT_RAR ? TYPE_RA_RNTI_ : TYPE_TC_RNTI_;
|
||||
int rnti_type = mac->ra.ra_state == nrRA_WAIT_RAR ? TYPE_RA_RNTI_ : TYPE_TC_RNTI_;
|
||||
config_dci_pdu(mac, dl_config, rnti_type, slot, pdcch_config->ra_SS);
|
||||
}
|
||||
}
|
||||
else if (mac->state == UE_CONNECTED) {
|
||||
} else if (mac->state == UE_CONNECTED) {
|
||||
for (int i = 0; i < pdcch_config->list_SS.count; i++) {
|
||||
NR_SearchSpace_t *ss = pdcch_config->list_SS.array[i];
|
||||
if (is_ss_monitor_occasion(frame, slot, slots_per_frame, ss))
|
||||
|
||||
@@ -178,7 +178,7 @@ int get_rnti_type(const NR_UE_MAC_INST_t *mac, const uint16_t rnti)
|
||||
|
||||
if (rnti == ra->ra_rnti) {
|
||||
rnti_type = TYPE_RA_RNTI_;
|
||||
} else if (rnti == ra->t_crnti && (ra->ra_state == WAIT_RAR || ra->ra_state == WAIT_CONTENTION_RESOLUTION)) {
|
||||
} else if (rnti == ra->t_crnti && (ra->ra_state == nrRA_WAIT_RAR || ra->ra_state == nrRA_WAIT_CONTENTION_RESOLUTION)) {
|
||||
rnti_type = TYPE_TC_RNTI_;
|
||||
} else if (rnti == mac->crnti) {
|
||||
rnti_type = TYPE_C_RNTI_;
|
||||
@@ -3504,7 +3504,7 @@ void nr_ue_process_mac_pdu(NR_UE_MAC_INST_t *mac, nr_downlink_indication_t *dl_i
|
||||
// MAC SDU: 6 bytes (UE Contention Resolution Identity)
|
||||
mac_len = 6;
|
||||
|
||||
if(ra->ra_state == WAIT_CONTENTION_RESOLUTION) {
|
||||
if (ra->ra_state == nrRA_WAIT_CONTENTION_RESOLUTION) {
|
||||
LOG_I(MAC, "[UE %d][RAPROC] Frame %d : received contention resolution identity: 0x%02x%02x%02x%02x%02x%02x Terminating RA procedure\n",
|
||||
mac->ue_id,
|
||||
frameP,
|
||||
@@ -3530,7 +3530,7 @@ void nr_ue_process_mac_pdu(NR_UE_MAC_INST_t *mac, nr_downlink_indication_t *dl_i
|
||||
} else if (!ra_success){
|
||||
// TODO: Handle failure of RA procedure @ MAC layer
|
||||
// nr_ra_failed(module_idP, CC_id, prach_resources, frameP, slot); // prach_resources is a PHY structure
|
||||
ra->ra_state = RA_UE_IDLE;
|
||||
ra->ra_state = nrRA_UE_IDLE;
|
||||
ra->RA_active = 0;
|
||||
}
|
||||
}
|
||||
@@ -3609,8 +3609,7 @@ int nr_write_ce_ulsch_pdu(uint8_t *mac_ce,
|
||||
pdu, mac_ce);
|
||||
}
|
||||
|
||||
if (crnti && (!get_softmodem_params()->sa && get_softmodem_params()->do_ra && mac->ra.ra_state != RA_SUCCEEDED)) {
|
||||
|
||||
if (crnti && (!get_softmodem_params()->sa && get_softmodem_params()->do_ra && mac->ra.ra_state != nrRA_SUCCEEDED)) {
|
||||
LOG_D(NR_MAC, "In %s: generating C-RNTI MAC CE with C-RNTI %x\n", __FUNCTION__, (*crnti));
|
||||
|
||||
// MAC CE fixed subheader
|
||||
@@ -3625,7 +3624,6 @@ int nr_write_ce_ulsch_pdu(uint8_t *mac_ce,
|
||||
mac_ce_size = sizeof(uint16_t);
|
||||
mac_ce += mac_ce_size;
|
||||
mac_ce_len += mac_ce_size + sizeof(NR_MAC_SUBHEADER_FIXED);
|
||||
|
||||
}
|
||||
|
||||
if (truncated_bsr) {
|
||||
|
||||
@@ -1075,7 +1075,7 @@ void nr_ue_ul_scheduler(NR_UE_MAC_INST_t *mac, nr_uplink_indication_t *ul_info)
|
||||
ulcfg_pdu->pusch_config_pdu.pusch_data.new_data_indicator,
|
||||
TBS_bytes,
|
||||
ra->ra_state);
|
||||
if (ra->ra_state == WAIT_RAR && !ra->cfra) {
|
||||
if (ra->ra_state == nrRA_WAIT_RAR && !ra->cfra) {
|
||||
nr_get_msg3_payload(mac, ulsch_input_buffer, TBS_bytes);
|
||||
for (int k = 0; k < TBS_bytes; k++) {
|
||||
LOG_D(NR_MAC, "(%i): 0x%x\n", k, ulsch_input_buffer[k]);
|
||||
@@ -1083,7 +1083,7 @@ void nr_ue_ul_scheduler(NR_UE_MAC_INST_t *mac, nr_uplink_indication_t *ul_info)
|
||||
mac_pdu_exist = 1;
|
||||
} else {
|
||||
if (ulcfg_pdu->pusch_config_pdu.pusch_data.new_data_indicator
|
||||
&& (mac->state == UE_CONNECTED || (ra->ra_state == WAIT_RAR && ra->cfra))) {
|
||||
&& (mac->state == UE_CONNECTED || (ra->ra_state == nrRA_WAIT_RAR && ra->cfra))) {
|
||||
// Getting IP traffic to be transmitted
|
||||
nr_ue_get_sdu(mac, cc_id, frame_tx, slot_tx, gNB_index, ulsch_input_buffer, TBS_bytes);
|
||||
mac_pdu_exist = 1;
|
||||
@@ -1096,13 +1096,13 @@ void nr_ue_ul_scheduler(NR_UE_MAC_INST_t *mac, nr_uplink_indication_t *ul_info)
|
||||
ulcfg_pdu->pusch_config_pdu.tx_request_body.pdu_length = TBS_bytes;
|
||||
number_of_pdus++;
|
||||
}
|
||||
if (ra->ra_state == WAIT_CONTENTION_RESOLUTION && !ra->cfra) {
|
||||
if (ra->ra_state == nrRA_WAIT_CONTENTION_RESOLUTION && !ra->cfra) {
|
||||
LOG_I(NR_MAC, "[RAPROC][%d.%d] RA-Msg3 retransmitted\n", frame_tx, slot_tx);
|
||||
// 38.321 restart the ra-ContentionResolutionTimer at each HARQ retransmission in the first symbol after the end of the Msg3
|
||||
// transmission
|
||||
nr_Msg3_transmitted(mac, cc_id, frame_tx, slot_tx, gNB_index);
|
||||
}
|
||||
if (ra->ra_state == WAIT_RAR && !ra->cfra) {
|
||||
if (ra->ra_state == nrRA_WAIT_RAR && !ra->cfra) {
|
||||
LOG_A(NR_MAC, "[RAPROC][%d.%d] RA-Msg3 transmitted\n", frame_tx, slot_tx);
|
||||
nr_Msg3_transmitted(mac, cc_id, frame_tx, slot_tx, gNB_index);
|
||||
}
|
||||
@@ -2501,7 +2501,7 @@ static void nr_ue_prach_scheduler(NR_UE_MAC_INST_t *mac, frame_t frameP, sub_fra
|
||||
{
|
||||
RA_config_t *ra = &mac->ra;
|
||||
ra->RA_offset = 2; // to compensate the rx frame offset at the gNB
|
||||
if(ra->ra_state != GENERATE_PREAMBLE)
|
||||
if (ra->ra_state != nrRA_GENERATE_PREAMBLE)
|
||||
return;
|
||||
|
||||
fapi_nr_config_request_t *cfg = &mac->phy_config.config_req;
|
||||
|
||||
@@ -942,7 +942,8 @@ bool nr_mac_prepare_ra_ue(gNB_MAC_INST *nrmac, uint32_t rnti, NR_CellGroupConfig
|
||||
uint8_t ra_index = 0;
|
||||
/* checking for free RA process */
|
||||
for(; ra_index < NR_NB_RA_PROC_MAX; ra_index++) {
|
||||
if((cc->ra[ra_index].state == RA_IDLE) && (!cc->ra[ra_index].cfra)) break;
|
||||
if ((cc->ra[ra_index].ra_state == nrRA_gNB_IDLE) && (!cc->ra[ra_index].cfra))
|
||||
break;
|
||||
}
|
||||
if (ra_index == NR_NB_RA_PROC_MAX) {
|
||||
LOG_E(NR_MAC, "RA processes are not available for CFRA RNTI %04x\n", rnti);
|
||||
|
||||
@@ -574,7 +574,7 @@ void nr_initiate_ra_proc(module_id_t module_idP,
|
||||
for (int i = 0; i < NR_NB_RA_PROC_MAX; i++) {
|
||||
|
||||
NR_RA_t *ra = &cc->ra[i];
|
||||
if (ra->state != RA_IDLE)
|
||||
if (ra->ra_state != nrRA_gNB_IDLE)
|
||||
continue;
|
||||
|
||||
pr_found = 0;
|
||||
@@ -648,21 +648,26 @@ void nr_initiate_ra_proc(module_id_t module_idP,
|
||||
LOG_D(NR_MAC, "%s() Msg2[%04d%d] SFN/SF:%04d%d\n", __FUNCTION__, ra->Msg2_frame, ra->Msg2_slot, frameP, slotP);
|
||||
|
||||
int loop = 0;
|
||||
bool exist_connected_ue, exist_in_pending_ra_ue;
|
||||
if (ra->rnti == 0) { // This condition allows for the usage of a preconfigured rnti for the CFRA
|
||||
rnti_t trial = 0;
|
||||
do {
|
||||
// 3GPP TS 38.321 version 15.13.0 Section 7.1 Table 7.1-1: RNTI values
|
||||
ra->rnti = (taus() % 0xffef) + 1;
|
||||
while (trial < 1 || trial > 0xffef)
|
||||
trial = (taus() % 0xffef) + 1;
|
||||
exist_connected_ue = find_nr_UE(&nr_mac->UE_info, trial) != NULL;
|
||||
exist_in_pending_ra_ue = find_nr_RA_id(module_idP, CC_id, trial) != -1;
|
||||
loop++;
|
||||
} while (loop != 100
|
||||
&& !((find_nr_UE(&nr_mac->UE_info, ra->rnti) == NULL) && (find_nr_RA_id(module_idP, CC_id, ra->rnti) == -1)
|
||||
&& ra->rnti >= 0x1 && ra->rnti <= 0xffef));
|
||||
} while (loop < 100 && (exist_connected_ue || exist_in_pending_ra_ue) );
|
||||
if (loop == 100) {
|
||||
LOG_E(NR_MAC, "[RAPROC] initialisation random access aborted\n");
|
||||
abort();
|
||||
LOG_E(NR_MAC, "[RAPROC] initialisation random access: no more available RNTIs for new UE\n");
|
||||
NR_SCHED_UNLOCK(&nr_mac->sched_lock);
|
||||
return;
|
||||
}
|
||||
ra->rnti = trial;
|
||||
}
|
||||
|
||||
ra->state = Msg2;
|
||||
ra->ra_state = nrRA_Msg2;
|
||||
ra->RA_rnti = ra_rnti;
|
||||
ra->preamble_index = preamble_index;
|
||||
ra->beam_id = cc->ssb_index[beam_index];
|
||||
@@ -887,7 +892,7 @@ static void nr_generate_Msg3_retransmission(module_id_t module_idP,
|
||||
ra->UL_BWP.scs);
|
||||
|
||||
// reset state to wait msg3
|
||||
ra->state = WAIT_Msg3;
|
||||
ra->ra_state = nrRA_WAIT_Msg3;
|
||||
ra->Msg3_frame = sched_frame;
|
||||
ra->Msg3_slot = sched_slot;
|
||||
|
||||
@@ -951,7 +956,7 @@ static void nr_get_Msg3alloc(module_id_t module_id,
|
||||
NrOfSymbols <= Msg3maxsymb) {
|
||||
ra->Msg3_tda_id = i;
|
||||
ra->msg3_startsymb = StartSymbolIndex;
|
||||
ra->msg3_nrsymb = NrOfSymbols;
|
||||
ra->msg3_nbSymb = NrOfSymbols;
|
||||
ra->Msg3_slot = temp_slot;
|
||||
break;
|
||||
}
|
||||
@@ -1134,13 +1139,13 @@ static void nr_add_msg3(module_id_t module_idP, int CC_id, frame_t frameP, sub_f
|
||||
NR_UE_UL_BWP_t *ul_bwp = &ra->UL_BWP;
|
||||
NR_UE_ServingCell_Info_t *sc_info = &ra->sc_info;
|
||||
|
||||
if (ra->state == RA_IDLE) {
|
||||
if (ra->ra_state == nrRA_gNB_IDLE) {
|
||||
LOG_W(NR_MAC,"RA is not active for RA %X. skipping msg3 scheduling\n", ra->rnti);
|
||||
return;
|
||||
}
|
||||
|
||||
const int scs = ul_bwp->scs;
|
||||
const uint16_t mask = SL_to_bitmap(ra->msg3_startsymb, ra->msg3_nrsymb);
|
||||
const uint16_t mask = SL_to_bitmap(ra->msg3_startsymb, ra->msg3_nbSymb);
|
||||
int buffer_index = ul_buffer_index(ra->Msg3_frame, ra->Msg3_slot, scs, mac->vrb_map_UL_size);
|
||||
uint16_t *vrb_map_UL = &RC.nrmac[module_idP]->common_channels[CC_id].vrb_map_UL[buffer_index * MAX_BWP_SIZE];
|
||||
for (int i = 0; i < ra->msg3_nb_rb; ++i) {
|
||||
@@ -1309,8 +1314,15 @@ static void nr_generate_Msg2(module_id_t module_idP,
|
||||
pdsch_pdu_rel15->precodingAndBeamforming.prgs_list[0].pm_idx = 0;
|
||||
pdsch_pdu_rel15->precodingAndBeamforming.prgs_list[0].dig_bf_interface_list[0].beam_idx = 0;
|
||||
|
||||
LOG_A(NR_MAC,"[gNB %d][RAPROC] CC_id %d Frame %d, slotP %d: Generating RA-Msg2 DCI, rnti 0x%x, state %d, CoreSetType %d\n",
|
||||
module_idP, CC_id, frameP, slotP, ra->RA_rnti, ra->state,pdcch_pdu_rel15->CoreSetType);
|
||||
LOG_A(NR_MAC,
|
||||
"[gNB %d][RAPROC] CC_id %d Frame %d, slotP %d: Generating RA-Msg2 DCI, rnti 0x%x, state %d, CoreSetType %d\n",
|
||||
module_idP,
|
||||
CC_id,
|
||||
frameP,
|
||||
slotP,
|
||||
ra->RA_rnti,
|
||||
ra->ra_state,
|
||||
pdcch_pdu_rel15->CoreSetType);
|
||||
|
||||
// SCF222: PDU index incremented for each PDSCH PDU sent in TX control message. This is used to associate control
|
||||
// information to data and is reset every slot.
|
||||
@@ -1483,8 +1495,14 @@ static void nr_generate_Msg2(module_id_t module_idP,
|
||||
vrb_map[BWPStart + rb + rbStart] |= SL_to_bitmap(tda_info.startSymbolIndex, tda_info.nrOfSymbols);
|
||||
}
|
||||
|
||||
ra->state = WAIT_Msg3;
|
||||
LOG_D(NR_MAC,"[gNB %d][RAPROC] Frame %d, Subframe %d: rnti %04x RA state %d\n", module_idP, frameP, slotP, ra->rnti, ra->state);
|
||||
ra->ra_state = nrRA_WAIT_Msg3;
|
||||
LOG_D(NR_MAC,
|
||||
"[gNB %d][RAPROC] Frame %d, Subframe %d: rnti %04x RA state %s\n",
|
||||
module_idP,
|
||||
frameP,
|
||||
slotP,
|
||||
ra->rnti,
|
||||
nrra_text[ra->ra_state]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1933,7 +1951,7 @@ static void nr_generate_Msg4(module_id_t module_idP,
|
||||
vrb_map[BWPStart + rb + rbStart] |= SL_to_bitmap(msg4_tda.startSymbolIndex, msg4_tda.nrOfSymbols);
|
||||
}
|
||||
|
||||
ra->state = WAIT_Msg4_ACK;
|
||||
ra->ra_state = nrRA_WAIT_Msg4_ACK;
|
||||
LOG_I(NR_MAC,"UE %04x Generate msg4: feedback at %4d.%2d, payload %d bytes, next state WAIT_Msg4_ACK\n", ra->rnti, pucch->frame, pucch->ul_slot, harq->tb_size);
|
||||
}
|
||||
}
|
||||
@@ -1971,7 +1989,7 @@ static void nr_check_Msg4_Ack(module_id_t module_id, int CC_id, frame_t frame, s
|
||||
}
|
||||
} else {
|
||||
LOG_I(NR_MAC, "(UE %04x) Received Nack of RA-Msg4. Preparing retransmission!\n", ra->rnti);
|
||||
ra->state = Msg4;
|
||||
ra->ra_state = nrRA_Msg4;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1981,7 +1999,7 @@ void nr_clear_ra_proc(module_id_t module_idP, int CC_id, frame_t frameP, NR_RA_t
|
||||
/* we assume that this function is mutex-protected from outside */
|
||||
NR_SCHED_ENSURE_LOCKED(&RC.nrmac[module_idP]->sched_lock);
|
||||
LOG_D(NR_MAC,"[gNB %d][RAPROC] CC_id %d Frame %d Clear Random access information rnti %x\n", module_idP, CC_id, frameP, ra->rnti);
|
||||
ra->state = RA_IDLE;
|
||||
ra->ra_state = nrRA_gNB_IDLE;
|
||||
ra->timing_offset = 0;
|
||||
ra->RRC_timer = 20;
|
||||
ra->msg3_round = 0;
|
||||
@@ -2122,10 +2140,10 @@ void nr_schedule_RA(module_id_t module_idP,
|
||||
NR_COMMON_channels_t *cc = &mac->common_channels[CC_id];
|
||||
for (int i = 0; i < NR_NB_RA_PROC_MAX; i++) {
|
||||
NR_RA_t *ra = &cc->ra[i];
|
||||
LOG_D(NR_MAC, "RA[state:%d]\n", ra->state);
|
||||
LOG_D(NR_MAC, "RA[state:%d]\n", ra->ra_state);
|
||||
|
||||
// Check RA Contention Resolution timer
|
||||
if (ra->state >= WAIT_Msg3) {
|
||||
if (ra->ra_state >= nrRA_WAIT_Msg3) {
|
||||
ra->contention_resolution_timer--;
|
||||
if (ra->contention_resolution_timer < 0) {
|
||||
LOG_W(NR_MAC, "(%d.%d) RA Contention Resolution timer expired for UE 0x%04x, RA procedure failed...\n", frameP, slotP, ra->rnti);
|
||||
@@ -2135,19 +2153,19 @@ void nr_schedule_RA(module_id_t module_idP,
|
||||
}
|
||||
}
|
||||
|
||||
switch (ra->state) {
|
||||
case Msg2:
|
||||
switch (ra->ra_state) {
|
||||
case nrRA_Msg2:
|
||||
nr_generate_Msg2(module_idP, CC_id, frameP, slotP, ra, DL_req, TX_req);
|
||||
break;
|
||||
case Msg3_retransmission:
|
||||
case nrRA_Msg3_retransmission:
|
||||
nr_generate_Msg3_retransmission(module_idP, CC_id, frameP, slotP, ra, ul_dci_req);
|
||||
break;
|
||||
case Msg3_dcch_dtch:
|
||||
case nrRA_Msg3_dcch_dtch:
|
||||
/* fallthrough */
|
||||
case Msg4:
|
||||
case nrRA_Msg4:
|
||||
nr_generate_Msg4(module_idP, CC_id, frameP, slotP, ra, DL_req, TX_req);
|
||||
break;
|
||||
case WAIT_Msg4_ACK:
|
||||
case nrRA_WAIT_Msg4_ACK:
|
||||
nr_check_Msg4_Ack(module_idP, CC_id, frameP, slotP, ra);
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -2000,15 +2000,12 @@ NR_UE_info_t *find_nr_UE(NR_UEs_t *UEs, rnti_t rntiP)
|
||||
|
||||
int find_nr_RA_id(module_id_t mod_idP, int CC_idP, rnti_t rntiP)
|
||||
{
|
||||
NR_RA_t *ra = &RC.nrmac[mod_idP]->common_channels[CC_idP].ra[0];
|
||||
NR_RA_t *ra = RC.nrmac[mod_idP]->common_channels[CC_idP].ra;
|
||||
|
||||
for (int RA_id = 0; RA_id < NR_NB_RA_PROC_MAX; RA_id++) {
|
||||
LOG_D(NR_MAC, "Checking RA_id %d for %x : state %d\n",
|
||||
RA_id,
|
||||
rntiP,
|
||||
ra[RA_id].state);
|
||||
LOG_D(NR_MAC, "Checking RA_id %d for %x : state %s\n", RA_id, rntiP, nrra_text[ra[RA_id].ra_state]);
|
||||
|
||||
if (ra[RA_id].state != RA_IDLE && ra[RA_id].rnti == rntiP)
|
||||
if (ra[RA_id].ra_state != nrRA_gNB_IDLE && ra[RA_id].rnti == rntiP)
|
||||
return RA_id;
|
||||
}
|
||||
|
||||
|
||||
@@ -223,7 +223,7 @@ static int nr_process_mac_pdu(instance_t module_idP,
|
||||
|
||||
for (int i = 0; i < NR_NB_RA_PROC_MAX; i++) {
|
||||
NR_RA_t *ra = &RC.nrmac[module_idP]->common_channels[CC_id].ra[i];
|
||||
if (ra->state >= WAIT_Msg3 && ra->rnti == UE->rnti) {
|
||||
if (ra->ra_state >= nrRA_WAIT_Msg3 && ra->rnti == UE->rnti) {
|
||||
// remove UE context just created after Msg.3 in some milliseconds
|
||||
// as the UE is one already known (not now, as the UE context is
|
||||
// still needed for the moment)
|
||||
@@ -231,7 +231,7 @@ static int nr_process_mac_pdu(instance_t module_idP,
|
||||
//mac_remove_nr_ue(RC.nrmac[module_idP], ra->rnti);
|
||||
// this UE is the one identified by the RNTI in pduP
|
||||
ra->rnti = ((pduP[1]&0xFF)<<8)|(pduP[2]&0xFF);
|
||||
ra->state = Msg3_dcch_dtch;
|
||||
ra->ra_state = nrRA_Msg3_dcch_dtch;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -315,7 +315,7 @@ static int nr_process_mac_pdu(instance_t module_idP,
|
||||
NR_UE_info_t* UE_idx = UE;
|
||||
for (int i = 0; i < NR_NB_RA_PROC_MAX; i++) {
|
||||
NR_RA_t *ra = &RC.nrmac[module_idP]->common_channels[CC_id].ra[i];
|
||||
if (ra->state >= WAIT_Msg3 && ra->rnti == UE->rnti) {
|
||||
if (ra->ra_state >= nrRA_WAIT_Msg3 && ra->rnti == UE->rnti) {
|
||||
uint8_t *next_subpduP = pduP + mac_subheader_len + mac_len;
|
||||
if ((pduP[mac_subheader_len+mac_len] & 0x3F) == UL_SCH_LCID_C_RNTI) {
|
||||
crnti = ((next_subpduP[1]&0xFF)<<8)|(next_subpduP[2]&0xFF);
|
||||
@@ -488,7 +488,7 @@ static bool get_UE_waiting_CFRA_msg3(const gNB_MAC_INST *gNB_mac, const int CC_i
|
||||
bool UE_waiting_CFRA_msg3 = false;
|
||||
for (int i = 0; i < NR_NB_RA_PROC_MAX; i++) {
|
||||
const NR_RA_t *ra = &gNB_mac->common_channels[CC_id].ra[i];
|
||||
if (ra->cfra == true && ra->state == WAIT_Msg3 && frame == ra->Msg3_frame && slot == ra->Msg3_slot) {
|
||||
if (ra->cfra == true && ra->ra_state == nrRA_WAIT_Msg3 && frame == ra->Msg3_frame && slot == ra->Msg3_slot) {
|
||||
UE_waiting_CFRA_msg3 = true;
|
||||
break;
|
||||
}
|
||||
@@ -512,7 +512,7 @@ void handle_nr_ul_harq(const int CC_idP,
|
||||
LOG_D(NR_MAC, "handle harq for rnti %04x, in RA process\n", crc_pdu->rnti);
|
||||
for (int i = 0; i < NR_NB_RA_PROC_MAX; ++i) {
|
||||
NR_RA_t *ra = &nrmac->common_channels[CC_idP].ra[i];
|
||||
if (ra->state >= WAIT_Msg3 && ra->rnti == crc_pdu->rnti) {
|
||||
if (ra->ra_state >= nrRA_WAIT_Msg3 && ra->rnti == crc_pdu->rnti) {
|
||||
NR_SCHED_UNLOCK(&nrmac->sched_lock);
|
||||
return;
|
||||
}
|
||||
@@ -708,11 +708,11 @@ static void _nr_rx_sdu(const module_id_t gnb_mod_idP,
|
||||
* it. */
|
||||
for (int i = 0; i < NR_NB_RA_PROC_MAX; ++i) {
|
||||
NR_RA_t *ra = &gNB_mac->common_channels[CC_idP].ra[i];
|
||||
if (ra->state != WAIT_Msg3)
|
||||
if (ra->ra_state != nrRA_WAIT_Msg3)
|
||||
continue;
|
||||
|
||||
if(no_sig) {
|
||||
LOG_D(NR_MAC, "Random Access %i failed at state %i (no signal)\n", i, ra->state);
|
||||
LOG_D(NR_MAC, "Random Access %i failed at state %s (no signal)\n", i, nrra_text[ra->ra_state]);
|
||||
nr_clear_ra_proc(gnb_mod_idP, CC_idP, frameP, ra);
|
||||
} else {
|
||||
|
||||
@@ -724,7 +724,12 @@ static void _nr_rx_sdu(const module_id_t gnb_mod_idP,
|
||||
current_rnti);
|
||||
|
||||
if( (frameP==ra->Msg3_frame) && (slotP==ra->Msg3_slot) ) {
|
||||
LOG_D(NR_MAC, "Random Access %i failed at state %i (TC_RNTI %04x RNTI %04x)\n", i, ra->state,ra->rnti,current_rnti);
|
||||
LOG_D(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(gnb_mod_idP, CC_idP, frameP, ra);
|
||||
}
|
||||
|
||||
@@ -733,7 +738,12 @@ static void _nr_rx_sdu(const module_id_t gnb_mod_idP,
|
||||
|
||||
NR_UE_info_t *UE_msg3_stage = UE ? UE : add_new_nr_ue(gNB_mac, ra->rnti, ra->CellGroup);
|
||||
if (!UE_msg3_stage) {
|
||||
LOG_W(NR_MAC, "Random Access %i discarded at state %i (TC_RNTI %04x RNTI %04x): max number of users achieved!\n", i, ra->state, ra->rnti, current_rnti);
|
||||
LOG_W(NR_MAC,
|
||||
"Random Access %i discarded at state %s (TC_RNTI %04x RNTI %04x): max number of users achieved!\n",
|
||||
i,
|
||||
nrra_text[ra->ra_state],
|
||||
ra->rnti,
|
||||
current_rnti);
|
||||
|
||||
nr_clear_ra_proc(gnb_mod_idP, CC_idP, frameP, ra);
|
||||
return;
|
||||
@@ -789,8 +799,7 @@ static void _nr_rx_sdu(const module_id_t gnb_mod_idP,
|
||||
// harq_pid set a non valid value because it is not used in this call
|
||||
// the function is only called to decode the contention resolution sub-header
|
||||
if (nr_process_mac_pdu(gnb_mod_idP, UE_msg3_stage, CC_idP, frameP, slotP, sduP, sdu_lenP, -1) == 0) {
|
||||
|
||||
if (ra->state == Msg3_dcch_dtch) {
|
||||
if (ra->ra_state == nrRA_Msg3_dcch_dtch) {
|
||||
// Check if the UE identified by C-RNTI still exists at the gNB
|
||||
NR_UE_info_t * UE_C = find_nr_UE(&gNB_mac->UE_info, ra->rnti);
|
||||
if (!UE_C) {
|
||||
@@ -815,11 +824,9 @@ static void _nr_rx_sdu(const module_id_t gnb_mod_idP,
|
||||
LOG_I(NR_MAC, "Received UL_SCH_LCID_C_RNTI with C-RNTI 0x%04x, triggering RRC Reconfiguration\n", UE_C->rnti);
|
||||
nr_mac_trigger_reconfiguration(RC.nrmac[gnb_mod_idP], UE_C);
|
||||
}
|
||||
}
|
||||
else {
|
||||
LOG_I(NR_MAC, "Activating scheduling RA-Msg4 for TC_RNTI 0x%04x (state %d)\n",
|
||||
ra->rnti, ra->state);
|
||||
ra->state = Msg4;
|
||||
} else {
|
||||
LOG_I(NR_MAC, "Activating scheduling RA-Msg4 for TC_RNTI 0x%04x (state %s)\n", ra->rnti, nrra_text[ra->ra_state]);
|
||||
ra->ra_state = nrRA_Msg4;
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -832,7 +839,7 @@ static void _nr_rx_sdu(const module_id_t gnb_mod_idP,
|
||||
} else {
|
||||
for (int i = 0; i < NR_NB_RA_PROC_MAX; ++i) {
|
||||
NR_RA_t *ra = &gNB_mac->common_channels[CC_idP].ra[i];
|
||||
if (ra->state != WAIT_Msg3)
|
||||
if (ra->ra_state != nrRA_WAIT_Msg3)
|
||||
continue;
|
||||
|
||||
if( (frameP!=ra->Msg3_frame) || (slotP!=ra->Msg3_slot))
|
||||
@@ -840,13 +847,13 @@ static void _nr_rx_sdu(const module_id_t gnb_mod_idP,
|
||||
|
||||
// for CFRA (NSA) do not schedule retransmission of msg3
|
||||
if (ra->cfra) {
|
||||
LOG_D(NR_MAC, "Random Access %i failed at state %i (NSA msg3 reception failed)\n", i, ra->state);
|
||||
LOG_D(NR_MAC, "Random Access %i failed at state %s (NSA msg3 reception failed)\n", i, nrra_text[ra->ra_state]);
|
||||
nr_clear_ra_proc(gnb_mod_idP, CC_idP, frameP, ra);
|
||||
return;
|
||||
}
|
||||
|
||||
if (ra->msg3_round >= gNB_mac->ul_bler.harq_round_max - 1) {
|
||||
LOG_W(NR_MAC, "Random Access %i failed at state %i (Reached msg3 max harq rounds)\n", i, ra->state);
|
||||
LOG_W(NR_MAC, "Random Access %i failed at state %s (Reached msg3 max harq rounds)\n", i, nrra_text[ra->ra_state]);
|
||||
nr_clear_ra_proc(gnb_mod_idP, CC_idP, frameP, ra);
|
||||
return;
|
||||
}
|
||||
@@ -854,7 +861,7 @@ static void _nr_rx_sdu(const module_id_t gnb_mod_idP,
|
||||
LOG_D(NR_MAC, "Random Access %i Msg3 CRC did not pass)\n", i);
|
||||
|
||||
ra->msg3_round++;
|
||||
ra->state = Msg3_retransmission;
|
||||
ra->ra_state = nrRA_Msg3_retransmission;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,6 +85,7 @@
|
||||
/* MAC */
|
||||
#include "LAYER2/NR_MAC_COMMON/nr_mac_extern.h"
|
||||
#include "LAYER2/NR_MAC_COMMON/nr_mac_common.h"
|
||||
#include "NR_TAG.h"
|
||||
|
||||
#include <openair3/UICC/usim_interface.h>
|
||||
|
||||
@@ -111,15 +112,16 @@ typedef struct {
|
||||
} NR_list_t;
|
||||
|
||||
typedef enum {
|
||||
RA_IDLE = 0,
|
||||
Msg2 = 1,
|
||||
WAIT_Msg3 = 2,
|
||||
Msg3_retransmission = 3,
|
||||
Msg3_dcch_dtch = 4,
|
||||
Msg4 = 5,
|
||||
WAIT_Msg4_ACK = 6
|
||||
nrRA_gNB_IDLE = 0,
|
||||
nrRA_Msg2 = 1,
|
||||
nrRA_WAIT_Msg3 = 2,
|
||||
nrRA_Msg3_retransmission = 3,
|
||||
nrRA_Msg3_dcch_dtch = 4,
|
||||
nrRA_Msg4 = 5,
|
||||
nrRA_WAIT_Msg4_ACK = 6
|
||||
} RA_gNB_state_t;
|
||||
|
||||
static const char *const nrra_text[] =
|
||||
{"IDLE", "Msg2", "WAIT_Msg3", "Msg3_retransmission", "Msg3_dcch_dtch", "Msg4", "WAIT_Msg4_ACK"};
|
||||
typedef struct nr_pdsch_AntennaPorts_t {
|
||||
int N1;
|
||||
int N2;
|
||||
@@ -160,7 +162,7 @@ typedef struct NR_sched_pdcch {
|
||||
/*! \brief gNB template for the Random access information */
|
||||
typedef struct {
|
||||
/// Flag to indicate this process is active
|
||||
RA_gNB_state_t state;
|
||||
RA_gNB_state_t ra_state;
|
||||
/// CORESET0 configured flag
|
||||
int coreset0_configured;
|
||||
/// Slot where preamble was received
|
||||
@@ -174,7 +176,7 @@ typedef struct {
|
||||
/// Frame where Msg3 is to be sent
|
||||
frame_t Msg3_frame;
|
||||
/// Msg3 time domain allocation index
|
||||
uint8_t Msg3_tda_id;
|
||||
int Msg3_tda_id;
|
||||
/// harq_pid used for Msg4 transmission
|
||||
uint8_t harq_pid;
|
||||
/// UE RNTI allocated during RAR
|
||||
@@ -190,25 +192,17 @@ typedef struct {
|
||||
/// Timeout for RRC connection
|
||||
int16_t RRC_timer;
|
||||
/// Msg3 first RB
|
||||
uint8_t msg3_first_rb;
|
||||
int msg3_first_rb;
|
||||
/// Msg3 number of RB
|
||||
uint8_t msg3_nb_rb;
|
||||
int msg3_nb_rb;
|
||||
/// Msg3 BWP start
|
||||
uint8_t msg3_bwp_start;
|
||||
int msg3_bwp_start;
|
||||
/// Msg3 TPC command
|
||||
uint8_t msg3_TPC;
|
||||
/// Msg3 ULdelay command
|
||||
uint8_t msg3_ULdelay;
|
||||
/// Msg3 cqireq command
|
||||
uint8_t msg3_cqireq;
|
||||
/// Round of Msg3 HARQ
|
||||
uint8_t msg3_round;
|
||||
int msg3_startsymb;
|
||||
int msg3_nrsymb;
|
||||
/// TBS used for Msg4
|
||||
int msg4_TBsize;
|
||||
/// MCS used for Msg4
|
||||
int msg4_mcs;
|
||||
int msg3_nbSymb;
|
||||
/// MAC PDU length for Msg4
|
||||
int mac_pdu_length;
|
||||
/// RA search space
|
||||
@@ -233,17 +227,12 @@ typedef struct {
|
||||
|
||||
/*! \brief gNB common channels */
|
||||
typedef struct {
|
||||
int Ncp;
|
||||
int nr_band;
|
||||
frame_type_t frame_type;
|
||||
uint64_t dl_CarrierFreq;
|
||||
NR_BCCH_BCH_Message_t *mib;
|
||||
NR_BCCH_DL_SCH_Message_t *sib1;
|
||||
NR_ServingCellConfigCommon_t *ServingCellConfigCommon;
|
||||
/// pre-configured ServingCellConfig that is default for every UE
|
||||
NR_ServingCellConfig_t *pre_ServingCellConfig;
|
||||
NR_ARFCN_ValueEUTRA_t ul_CarrierFreq;
|
||||
long ul_Bandwidth;
|
||||
/// Outgoing MIB PDU for PHY
|
||||
uint8_t MIB_pdu[3];
|
||||
/// Outgoing BCCH pdu for PHY
|
||||
@@ -256,23 +245,20 @@ typedef struct {
|
||||
/// VRB map for common channels and PUSCH, dynamically allocated because
|
||||
/// length depends on number of slots and RBs
|
||||
uint16_t *vrb_map_UL;
|
||||
/// number of subframe allocation pattern available for MBSFN sync area
|
||||
uint8_t num_sf_allocation_pattern;
|
||||
///Number of active SSBs
|
||||
uint8_t num_active_ssb;
|
||||
int num_active_ssb;
|
||||
//Total available prach occasions per configuration period
|
||||
uint32_t total_prach_occasions_per_config_period;
|
||||
int total_prach_occasions_per_config_period;
|
||||
//Total available prach occasions
|
||||
uint32_t total_prach_occasions;
|
||||
int total_prach_occasions;
|
||||
//Max Association period
|
||||
uint8_t max_association_period;
|
||||
int max_association_period;
|
||||
//SSB index
|
||||
uint8_t ssb_index[MAX_NUM_OF_SSB];
|
||||
//CB preambles for each SSB
|
||||
uint8_t cb_preambles_per_ssb;
|
||||
int cb_preambles_per_ssb;
|
||||
} NR_COMMON_channels_t;
|
||||
|
||||
|
||||
// SP ZP CSI-RS Resource Set Activation/Deactivation MAC CE
|
||||
typedef struct sp_zp_csirs {
|
||||
bool is_scheduled; //ZP CSI-RS ACT/Deact MAC CE is scheduled
|
||||
|
||||
@@ -348,13 +348,13 @@ static bool is_my_dci(NR_UE_MAC_INST_t *mac, nfapi_nr_dl_dci_pdu_t *received_pdu
|
||||
return false;
|
||||
if (received_pdu->RNTI == 0xFFFF && mac->phy_config_request_sent)
|
||||
return false;
|
||||
if (received_pdu->RNTI != mac->crnti && mac->ra.ra_state == RA_SUCCEEDED)
|
||||
if (received_pdu->RNTI != mac->crnti && mac->ra.ra_state == nrRA_SUCCEEDED)
|
||||
return false;
|
||||
if (received_pdu->RNTI != mac->ra.t_crnti && mac->ra.ra_state == WAIT_CONTENTION_RESOLUTION)
|
||||
if (received_pdu->RNTI != mac->ra.t_crnti && mac->ra.ra_state == nrRA_WAIT_CONTENTION_RESOLUTION)
|
||||
return false;
|
||||
if (received_pdu->RNTI != 0x10b && mac->ra.ra_state == WAIT_RAR)
|
||||
if (received_pdu->RNTI != 0x10b && mac->ra.ra_state == nrRA_WAIT_RAR)
|
||||
return false;
|
||||
if (received_pdu->RNTI != 0xFFFF && mac->ra.ra_state <= GENERATE_PREAMBLE)
|
||||
if (received_pdu->RNTI != 0xFFFF && mac->ra.ra_state <= nrRA_GENERATE_PREAMBLE)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -477,8 +477,7 @@ static void fill_rx_ind(nfapi_nr_pdu_t *pdu_list, fapi_nr_rx_indication_t *rx_in
|
||||
pdu += pdu_list->TLVs[j].length;
|
||||
}
|
||||
bool ack_nack = true;
|
||||
if (mac->ra.ra_state >= RA_SUCCEEDED && should_drop_transport_block(rx_ind->slot, mac->crnti))
|
||||
{
|
||||
if (mac->ra.ra_state >= nrRA_SUCCEEDED && should_drop_transport_block(rx_ind->slot, mac->crnti)) {
|
||||
ack_nack = false;
|
||||
}
|
||||
rx_ind->rx_indication_body[pdu_idx].pdsch_pdu.ack_nack = ack_nack;
|
||||
@@ -742,10 +741,8 @@ void check_and_process_dci(nfapi_nr_dl_tti_request_t *dl_tti_request,
|
||||
int slots_per_frame = 20; //30 kHZ subcarrier spacing
|
||||
int slot_ahead = 2; // TODO: Make this dynamic
|
||||
|
||||
if (is_nr_UL_slot(mac->tdd_UL_DL_ConfigurationCommon,
|
||||
(slot + slot_ahead) % slots_per_frame,
|
||||
mac->frame_type)
|
||||
&& mac->ra.ra_state != RA_SUCCEEDED) {
|
||||
if (is_nr_UL_slot(mac->tdd_UL_DL_ConfigurationCommon, (slot + slot_ahead) % slots_per_frame, mac->frame_type)
|
||||
&& mac->ra.ra_state != nrRA_SUCCEEDED) {
|
||||
// If we filled dl_info AFTER we got the slot indication, we want to check if we should fill tx_req:
|
||||
nr_uplink_indication_t ul_info = {.slot = (slot + slot_ahead) % slots_per_frame,
|
||||
.frame = slot + slot_ahead >= slots_per_frame ? (frame + 1) % 1024 : frame};
|
||||
@@ -873,25 +870,22 @@ static void enqueue_nr_nfapi_msg(void *buffer, ssize_t len, nfapi_p7_message_hea
|
||||
NFAPI_NR_UL_CONFIG_PUSCH_PDU_TYPE. If we have not yet completed the CBRA/
|
||||
CFRA procedure, we need to queue all UL_TTI_REQs. */
|
||||
for (int i = 0; i < ul_tti_request->n_pdus; i++) {
|
||||
if (ul_tti_request->pdus_list[i].pdu_type == NFAPI_NR_UL_CONFIG_PUSCH_PDU_TYPE &&
|
||||
mac->ra.ra_state >= RA_SUCCEEDED) {
|
||||
if (!put_queue(&nr_ul_tti_req_queue, ul_tti_request))
|
||||
{
|
||||
LOG_D(NR_PHY, "put_queue failed for ul_tti_request, calling put_queue_replace.\n");
|
||||
nfapi_nr_ul_tti_request_t *evicted_ul_tti_req = put_queue_replace(&nr_ul_tti_req_queue, ul_tti_request);
|
||||
free(evicted_ul_tti_req);
|
||||
}
|
||||
break;
|
||||
if (ul_tti_request->pdus_list[i].pdu_type == NFAPI_NR_UL_CONFIG_PUSCH_PDU_TYPE
|
||||
&& mac->ra.ra_state >= nrRA_SUCCEEDED) {
|
||||
if (!put_queue(&nr_ul_tti_req_queue, ul_tti_request)) {
|
||||
LOG_D(NR_PHY, "put_queue failed for ul_tti_request, calling put_queue_replace.\n");
|
||||
nfapi_nr_ul_tti_request_t *evicted_ul_tti_req = put_queue_replace(&nr_ul_tti_req_queue, ul_tti_request);
|
||||
free(evicted_ul_tti_req);
|
||||
}
|
||||
else if (mac->ra.ra_state < RA_SUCCEEDED) {
|
||||
if (!put_queue(&nr_ul_tti_req_queue, ul_tti_request))
|
||||
{
|
||||
LOG_D(NR_PHY, "put_queue failed for ul_tti_request, calling put_queue_replace.\n");
|
||||
nfapi_nr_ul_tti_request_t *evicted_ul_tti_req = put_queue_replace(&nr_ul_tti_req_queue, ul_tti_request);
|
||||
free(evicted_ul_tti_req);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
} else if (mac->ra.ra_state < nrRA_SUCCEEDED) {
|
||||
if (!put_queue(&nr_ul_tti_req_queue, ul_tti_request)) {
|
||||
LOG_D(NR_PHY, "put_queue failed for ul_tti_request, calling put_queue_replace.\n");
|
||||
nfapi_nr_ul_tti_request_t *evicted_ul_tti_req = put_queue_replace(&nr_ul_tti_req_queue, ul_tti_request);
|
||||
free(evicted_ul_tti_req);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -922,8 +916,7 @@ static void save_pdsch_pdu_for_crnti(nfapi_nr_dl_tti_request_t *dl_tti_request)
|
||||
if (pdu_list->PDUType == NFAPI_NR_DL_TTI_PDSCH_PDU_TYPE)
|
||||
{
|
||||
const nfapi_nr_dl_tti_pdsch_pdu_rel15_t *pdsch_pdu = &pdu_list->pdsch_pdu.pdsch_pdu_rel15;
|
||||
if (pdsch_pdu->rnti == mac->crnti && mac->ra.ra_state == RA_SUCCEEDED)
|
||||
{
|
||||
if (pdsch_pdu->rnti == mac->crnti && mac->ra.ra_state == nrRA_SUCCEEDED) {
|
||||
read_channel_param(pdsch_pdu, dl_tti_request->Slot, count_sent);
|
||||
count_sent++;
|
||||
LOG_T(NR_MAC, "pdsch_pdu->rnti %x mac->crnti %x mac->ra.ra_state %d count_sent %d\n",
|
||||
@@ -1124,7 +1117,7 @@ void update_harq_status(NR_UE_MAC_INST_t *mac, uint8_t harq_pid, uint8_t ack_nac
|
||||
if (current_harq->active) {
|
||||
LOG_D(PHY,"Updating harq_status for harq_id %d, ack/nak %d\n", harq_pid, current_harq->ack);
|
||||
// we can prepare feedback for MSG4 in advance
|
||||
if (mac->ra.ra_state == WAIT_CONTENTION_RESOLUTION)
|
||||
if (mac->ra.ra_state == nrRA_WAIT_CONTENTION_RESOLUTION)
|
||||
prepare_msg4_feedback(mac, harq_pid, ack_nack);
|
||||
else {
|
||||
current_harq->ack = ack_nack;
|
||||
|
||||
@@ -121,8 +121,7 @@ bool should_drop_transport_block(int slot, uint16_t rnti)
|
||||
|
||||
/* We want to avoid dropping setup messages because this would be pathological. */
|
||||
NR_UE_MAC_INST_t *mac = get_mac_inst(0);
|
||||
if (mac->ra.ra_state < RA_SUCCEEDED)
|
||||
{
|
||||
if (mac->ra.ra_state < nrRA_SUCCEEDED) {
|
||||
LOG_D(NR_MAC, "Not dropping because MAC state: %d", mac->ra.ra_state);
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user