Commit 11b87d87 authored by Thomas Schlichter's avatar Thomas Schlichter

NR UE: RRC layer now explicitly tells MAC layer when the RA procedure can be started

parent 48c8d673
......@@ -477,9 +477,11 @@ typedef struct {
} nr_mac_rrc_config_mib_t;
typedef struct {
NR_SIB1_t *sib1;
bool can_start_ra;
} nr_mac_rrc_config_sib1_t;
typedef struct {
NR_SIB19_r17_t *sib19;
bool can_start_ra;
} nr_mac_rrc_config_other_sib_t;
#endif /* RRC_MESSAGES_TYPES_H_ */
......@@ -936,8 +936,6 @@ void nr_rrc_mac_config_req_mib(module_id_t module_id,
mac->get_sib1 = true;
else if (sched_sib == 2)
mac->get_otherSI = true;
else if (sched_sib == 0 && mac->state == UE_RECEIVING_SIB)
mac->state = UE_PERFORMING_RA;
nr_ue_decode_mib(mac, cc_idP);
ret = pthread_mutex_unlock(&mac->if_mutex);
AssertFatal(!ret, "mutex failed %d\n", ret);
......@@ -1756,7 +1754,7 @@ static void configure_si_schedulingInfo(NR_UE_MAC_INST_t *mac,
}
}
void nr_rrc_mac_config_req_sib1(module_id_t module_id, int cc_idP, NR_SIB1_t *sib1)
void nr_rrc_mac_config_req_sib1(module_id_t module_id, int cc_idP, NR_SIB1_t *sib1, bool can_start_ra)
{
NR_UE_MAC_INST_t *mac = get_mac_inst(module_id);
int ret = pthread_mutex_lock(&mac->if_mutex);
......@@ -1792,6 +1790,8 @@ void nr_rrc_mac_config_req_sib1(module_id_t module_id, int cc_idP, NR_SIB1_t *si
AssertFatal(mac->current_UL_BWP, "Couldn't find DL-BWP0\n");
configure_timeAlignmentTimer(&mac->time_alignment_timer, mac->timeAlignmentTimerCommon, mac->current_UL_BWP->scs);
}
if (mac->state == UE_RECEIVING_SIB && can_start_ra)
mac->state = UE_PERFORMING_RA;
// Setup the SSB to Rach Occasions mapping according to the config
build_ssb_to_ro_map(mac);
......@@ -1802,7 +1802,7 @@ void nr_rrc_mac_config_req_sib1(module_id_t module_id, int cc_idP, NR_SIB1_t *si
AssertFatal(!ret, "mutex failed %d\n", ret);
}
void nr_rrc_mac_config_other_sib(module_id_t module_id, NR_SIB19_r17_t *sib19)
void nr_rrc_mac_config_other_sib(module_id_t module_id, NR_SIB19_r17_t *sib19, bool can_start_ra)
{
NR_UE_MAC_INST_t *mac = get_mac_inst(module_id);
int ret = pthread_mutex_lock(&mac->if_mutex);
......@@ -1815,6 +1815,8 @@ void nr_rrc_mac_config_other_sib(module_id_t module_id, NR_SIB19_r17_t *sib19)
configure_ntn_ta(mac->ue_id, &mac->ntn_ta, ntn_Config_r17);
}
if (mac->state == UE_RECEIVING_SIB && can_start_ra)
mac->state = UE_PERFORMING_RA;
ret = pthread_mutex_unlock(&mac->if_mutex);
AssertFatal(!ret, "mutex failed %d\n", ret);
}
......
......@@ -85,10 +85,10 @@ void nr_rrc_mac_config_req_mib(module_id_t module_id,
NR_MIB_t *mibP,
int sched_sib1);
void nr_rrc_mac_config_req_sib1(module_id_t module_id, int cc_idP, NR_SIB1_t *sib1);
void nr_rrc_mac_config_req_sib1(module_id_t module_id, int cc_idP, NR_SIB1_t *sib1, bool can_start_ra);
struct position; /* forward declaration */
void nr_rrc_mac_config_other_sib(module_id_t module_id, NR_SIB19_r17_t *sib19_r17);
void nr_rrc_mac_config_other_sib(module_id_t module_id, NR_SIB19_r17_t *sib19_r17, bool can_start_ra);
void nr_rrc_mac_config_req_reset(module_id_t module_id, NR_UE_MAC_reset_cause_t cause);
......
......@@ -138,12 +138,14 @@ void process_msg_rcc_to_mac(MessageDef *msg)
break;
case NR_MAC_RRC_CONFIG_SIB1: {
NR_SIB1_t *sib1 = NR_MAC_RRC_CONFIG_SIB1(msg).sib1;
nr_rrc_mac_config_req_sib1(ue_id, 0, sib1);
bool can_start_ra = NR_MAC_RRC_CONFIG_SIB1(msg).can_start_ra;
nr_rrc_mac_config_req_sib1(ue_id, 0, sib1, can_start_ra);
SEQUENCE_free(&asn_DEF_NR_SIB1, NR_MAC_RRC_CONFIG_SIB1(msg).sib1, ASFM_FREE_EVERYTHING);
} break;
case NR_MAC_RRC_CONFIG_OTHER_SIB:
nr_rrc_mac_config_other_sib(ue_id, NR_MAC_RRC_CONFIG_OTHER_SIB(msg).sib19);
break;
case NR_MAC_RRC_CONFIG_OTHER_SIB: {
bool can_start_ra = NR_MAC_RRC_CONFIG_OTHER_SIB(msg).can_start_ra;
nr_rrc_mac_config_other_sib(ue_id, NR_MAC_RRC_CONFIG_OTHER_SIB(msg).sib19, can_start_ra);
} break;
default:
LOG_E(NR_MAC, "Unexpected msg from RRC: %d\n", ITTI_MSG_ID(msg));
}
......
......@@ -165,8 +165,9 @@ static void set_DRB_status(NR_UE_RRC_INST_t *rrc, NR_DRB_Identity_t drb_id, NR_R
rrc->status_DRBs[drb_id - 1] = status;
}
static void nr_decode_SI(NR_UE_RRC_SI_INFO *SI_info, NR_SystemInformation_t *si, instance_t ue_id)
static void nr_decode_SI(NR_UE_RRC_SI_INFO *SI_info, NR_SystemInformation_t *si, NR_UE_RRC_INST_t *rrc)
{
instance_t ue_id = rrc->ue_id;
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_UE_DECODE_SI, VCD_FUNCTION_IN);
// Dump contents
......@@ -253,6 +254,7 @@ static void nr_decode_SI(NR_UE_RRC_SI_INFO *SI_info, NR_SystemInformation_t *si,
if (sib19) {
MessageDef *msg = itti_alloc_new_message(TASK_RRC_NRUE, 0, NR_MAC_RRC_CONFIG_OTHER_SIB);
asn_copy(&asn_DEF_NR_SIB19_r17, (void **)&NR_MAC_RRC_CONFIG_OTHER_SIB(msg).sib19, sib19);
NR_MAC_RRC_CONFIG_OTHER_SIB(msg).can_start_ra = rrc->is_NTN_UE;
itti_send_msg_to_task(TASK_MAC_UE, ue_id, msg);
}
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_UE_DECODE_SI, VCD_FUNCTION_OUT);
......@@ -308,7 +310,7 @@ static void nr_rrc_configure_default_SI(NR_UE_RRC_SI_INFO *SI_info,
}
}
static void verify_NTN_access(const NR_UE_RRC_SI_INFO *SI_info, const NR_SIB1_v1700_IEs_t *sib1_v1700)
static bool verify_NTN_access(const NR_UE_RRC_SI_INFO *SI_info, const NR_SIB1_v1700_IEs_t *sib1_v1700)
{
// SIB1 indicates if NTN access is present in the cell
bool ntn_access = false;
......@@ -320,6 +322,8 @@ static void verify_NTN_access(const NR_UE_RRC_SI_INFO *SI_info, const NR_SIB1_v1
int sib19_present = SI_info->SInfo_r17.default_otherSI_map_r17 & sib19_mask;
AssertFatal(!ntn_access || sib19_present, "NTN cell, but SIB19 not configured.\n");
return ntn_access && sib19_present;
}
static void nr_rrc_process_sib1(NR_UE_RRC_INST_t *rrc, NR_UE_RRC_SI_INFO *SI_info, NR_SIB1_t *sib1)
......@@ -346,7 +350,7 @@ static void nr_rrc_process_sib1(NR_UE_RRC_INST_t *rrc, NR_UE_RRC_SI_INFO *SI_inf
// configure default SI
nr_rrc_configure_default_SI(SI_info, sib1->si_SchedulingInfo, si_SchedInfo_v1700);
verify_NTN_access(SI_info, sib1_v1700);
rrc->is_NTN_UE = verify_NTN_access(SI_info, sib1_v1700);
// configure timers and constant
nr_rrc_set_sib1_timers_and_constants(&rrc->timers_and_constants, sib1);
......@@ -354,6 +358,7 @@ static void nr_rrc_process_sib1(NR_UE_RRC_INST_t *rrc, NR_UE_RRC_SI_INFO *SI_inf
UPDATE_IE(rrc->timers_and_constants.sib1_TimersAndConstants, sib1->ue_TimersAndConstants, NR_UE_TimersAndConstants_t);
MessageDef *msg = itti_alloc_new_message(TASK_RRC_NRUE, 0, NR_MAC_RRC_CONFIG_SIB1);
NR_MAC_RRC_CONFIG_SIB1(msg).sib1 = sib1;
NR_MAC_RRC_CONFIG_SIB1(msg).can_start_ra = !rrc->is_NTN_UE;
itti_send_msg_to_task(TASK_MAC_UE, rrc->ue_id, msg);
}
......@@ -414,7 +419,7 @@ static void nr_rrc_process_reconfiguration_v1530(NR_UE_RRC_INST_t *rrc, NR_RRCRe
SEQUENCE_free(&asn_DEF_NR_SystemInformation, si, 1);
} else {
LOG_I(NR_RRC, "[UE %ld] Decoding dedicatedSystemInformationDelivery\n", rrc->ue_id);
nr_decode_SI(SI_info, si, rrc->ue_id);
nr_decode_SI(SI_info, si, rrc);
}
}
if (rec_1530->otherConfig) {
......@@ -976,7 +981,7 @@ static int8_t nr_rrc_ue_decode_NR_BCCH_DL_SCH_Message(NR_UE_RRC_INST_t *rrc,
case NR_BCCH_DL_SCH_MessageType__c1_PR_systemInformation:
LOG_I(NR_RRC, "[UE %ld] Decoding SI\n", rrc->ue_id);
NR_SystemInformation_t *si = bcch_message->message.choice.c1->choice.systemInformation;
nr_decode_SI(SI_info, si, rrc->ue_id);
nr_decode_SI(SI_info, si, rrc);
break;
case NR_BCCH_DL_SCH_MessageType__c1_PR_NOTHING:
default:
......
......@@ -241,6 +241,8 @@ typedef struct NR_UE_RRC_INST_s {
bool reconfig_after_reestab;
//Sidelink params
NR_SL_PreconfigurationNR_r16_t *sl_preconfig;
// NTN params
bool is_NTN_UE;
} NR_UE_RRC_INST_t;
#endif
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