improvements in T302 handling at RRC UE

This commit is contained in:
francescomani
2025-07-03 08:27:38 +02:00
committed by Robert Schmidt
parent 88af2860a2
commit 8932566d2b
9 changed files with 48 additions and 13 deletions
+1 -1
View File
@@ -953,7 +953,7 @@ printf("%d\n", slot);
//Configure UE
NR_BCCH_BCH_Message_t *mib = get_new_MIB_NR(scc);
nr_rrc_mac_config_req_mib(0, 0, mib->message.choice.mib, false);
nr_rrc_mac_config_req_mib(0, 0, mib->message.choice.mib, false, false);
nr_rrc_mac_config_req_cg(0, 0, UE_CellGroup, UE_Capability_nr);
asn1cFreeStruc(asn_DEF_NR_CellGroupConfig, UE_CellGroup);
+1
View File
@@ -486,6 +486,7 @@ typedef struct {
typedef struct {
NR_BCCH_BCH_Message_t *bcch;
int get_sib;
bool access_barred;
} nr_mac_rrc_config_mib_t;
typedef struct {
NR_SIB1_t *sib1;
+8 -1
View File
@@ -955,7 +955,7 @@ static void update_mib_conf(NR_MIB_t *target, NR_MIB_t *source)
target->intraFreqReselection = source->intraFreqReselection;
}
void nr_rrc_mac_config_req_mib(module_id_t module_id, int cc_idP, NR_MIB_t *mib, int sched_sib)
void nr_rrc_mac_config_req_mib(module_id_t module_id, int cc_idP, NR_MIB_t *mib, int sched_sib, bool barred)
{
NR_UE_MAC_INST_t *mac = get_mac_inst(module_id);
int ret = pthread_mutex_lock(&mac->if_mutex);
@@ -963,6 +963,13 @@ void nr_rrc_mac_config_req_mib(module_id_t module_id, int cc_idP, NR_MIB_t *mib,
AssertFatal(mib, "MIB should not be NULL\n");
if (!mac->mib)
mac->mib = calloc(1, sizeof(*mac->mib));
if (barred)
mac->state = UE_BARRED;
else if (mac->state == UE_BARRED) {
// it is synched as we received MIB
// nr_ue_decode_mib is transitionining to the correct state
mac->state = UE_NOT_SYNC;
}
update_mib_conf(mac->mib, mib);
mac->phy_config.Mod_id = module_id;
mac->phy_config.CC_id = cc_idP;
+1 -1
View File
@@ -87,7 +87,7 @@ void nr_rrc_mac_config_req_cg(module_id_t module_id,
NR_CellGroupConfig_t *cell_group_config,
NR_UE_NR_Capability_t *ue_Capability);
void nr_rrc_mac_config_req_mib(module_id_t module_id, int cc_idP, NR_MIB_t *mibP, int sched_sib1);
void nr_rrc_mac_config_req_mib(module_id_t module_id, int cc_idP, NR_MIB_t *mibP, int sched_sib1, bool barred);
void nr_rrc_mac_config_req_sib1(module_id_t module_id, int cc_idP, NR_SIB1_t *sib1, bool can_start_ra);
+5 -1
View File
@@ -133,7 +133,11 @@ void process_msg_rcc_to_mac(MessageDef *msg)
asn1cFreeStruc(asn_DEF_NR_CellGroupConfig, NR_MAC_RRC_CONFIG_CG(msg).cellGroupConfig);
break;
case NR_MAC_RRC_CONFIG_MIB:
nr_rrc_mac_config_req_mib(ue_id, 0, NR_MAC_RRC_CONFIG_MIB(msg).bcch->message.choice.mib, NR_MAC_RRC_CONFIG_MIB(msg).get_sib);
nr_rrc_mac_config_req_mib(ue_id,
0,
NR_MAC_RRC_CONFIG_MIB(msg).bcch->message.choice.mib,
NR_MAC_RRC_CONFIG_MIB(msg).get_sib,
NR_MAC_RRC_CONFIG_MIB(msg).access_barred);
ASN_STRUCT_FREE(asn_DEF_NR_BCCH_BCH_Message, NR_MAC_RRC_CONFIG_MIB(msg).bcch);
break;
case NR_MAC_RRC_CONFIG_SIB1: {
+22 -8
View File
@@ -749,6 +749,7 @@ NR_UE_RRC_INST_t* nr_rrc_init_ue(char* uecap_file, int nb_inst, int num_ant_tx)
rrc->reconfig_after_reestab = false;
/* 5G-S-TMSI */
rrc->fiveG_S_TMSI = UINT64_MAX;
rrc->access_barred = false;
FILE *f = NULL;
if (uecap_file)
@@ -959,11 +960,12 @@ static void nr_rrc_ue_decode_NR_BCCH_BCH_Message(NR_UE_RRC_INST_t *rrc,
}
NR_UE_RRC_SI_INFO *SI_info = &rrc->perNB[gNB_index].SInfo;
bool barred = rrc->access_barred || bcch_message->message.choice.mib->cellBarred == NR_MIB__cellBarred_barred;
int get_sib = 0;
if (IS_SA_MODE(get_softmodem_params())
&& !SI_info->sib_pending
&& bcch_message->message.present == NR_BCCH_BCH_MessageType_PR_mib
&& bcch_message->message.choice.mib->cellBarred == NR_MIB__cellBarred_notBarred
&& !barred
&& rrc->nrRrcState != RRC_STATE_DETACH_NR) {
// to schedule MAC to get SI if required
get_sib = check_si_status(SI_info);
@@ -975,6 +977,7 @@ static void nr_rrc_ue_decode_NR_BCCH_BCH_Message(NR_UE_RRC_INST_t *rrc,
// mac will manage the pointer
NR_MAC_RRC_CONFIG_MIB(msg).bcch = bcch_message;
NR_MAC_RRC_CONFIG_MIB(msg).get_sib = get_sib;
NR_MAC_RRC_CONFIG_MIB(msg).access_barred = barred;
itti_send_msg_to_task(TASK_MAC_UE, rrc->ue_id, msg);
} else {
LOG_E(NR_RRC, "RRC-received BCCH message is not a MIB\n");
@@ -1376,7 +1379,11 @@ static void nr_rrc_process_rrcsetup(NR_UE_RRC_INST_t *rrc, const NR_RRCSetup_t *
nr_timer_stop(&timers->T319);
nr_timer_stop(&timers->T320);
// TODO if T390 and T302 are running (not implemented)
// if T390 (not implemented) and T302 are running
// stop timer
// perform the actions as specified in 5.3.14.4
nr_timer_stop(&timers->T302);
handle_302_expired_stopped(rrc);
// if the RRCSetup is received in response to an RRCResumeRequest, RRCResumeRequest1 or RRCSetupRequest
// enter RRC_CONNECTED
@@ -1417,6 +1424,7 @@ static void nr_rrc_process_rrcreject(NR_UE_RRC_INST_t *rrc, const NR_RRCReject_t
if (waitTime) {
nr_timer_setup(&timers->T302, *waitTime * 1000, 10);
nr_timer_start(&timers->T302);
rrc->access_barred = true;
} else {
LOG_W(RRC, "Error: waitTime should be always included in RRCReject message\n");
}
@@ -1458,7 +1466,7 @@ static int8_t nr_rrc_ue_decode_ccch(NR_UE_RRC_INST_t *rrc, const NRRrcMacCcchDat
break;
case NR_DL_CCCH_MessageType__c1_PR_rrcReject:
LOG_I(NR_RRC, "[UE%ld] Logical Channel DL-CCCH (SRB0), Received RRCReject \n", rrc->ue_id);
LOG_W(NR_RRC, "[UE%ld] Logical Channel DL-CCCH (SRB0), Received RRCReject \n", rrc->ue_id);
nr_rrc_process_rrcreject(rrc, dl_ccch_msg->message.choice.c1->choice.rrcReject);
rval = 0;
break;
@@ -2777,17 +2785,16 @@ void nr_rrc_going_to_IDLE(NR_UE_RRC_INST_t *rrc,
nr_timer_setup(&tac->T302, target, 10);
nr_timer_start(&tac->T302);
// TODO inform upper layers that access barring is applicable
// for all access categories except categories '0' and '2'.
LOG_E(NR_RRC,"Go to IDLE. Handling RRCRelease message including a waitTime not implemented\n");
// for all access categories except categories '0' and '2'.
// for now we just set the access barred in RRC
rrc->access_barred = true;
}
}
}
if (!waitTime) {
if (nr_timer_is_active(&tac->T302)) {
nr_timer_stop(&tac->T302);
// TODO barring alleviation as in 5.3.14.4
// not implemented
LOG_E(NR_RRC,"Go to IDLE. Barring alleviation not implemented\n");
handle_302_expired_stopped(rrc);
}
}
if (nr_timer_is_active(&tac->T390)) {
@@ -2897,6 +2904,13 @@ void nr_rrc_going_to_IDLE(NR_UE_RRC_INST_t *rrc,
itti_send_msg_to_task(TASK_NAS_NRUE, rrc->ue_id, msg_p);
}
void handle_302_expired_stopped(NR_UE_RRC_INST_t *rrc)
{
// for each Access Category for which T390 (TODO not implemented) is not running
// consider the barring for this Access Category to be alleviated
rrc->access_barred = false;
}
void handle_t300_expiry(NR_UE_RRC_INST_t *rrc)
{
rrc->ra_trigger = RRC_CONNECTION_SETUP;
+1 -1
View File
@@ -205,7 +205,7 @@ typedef struct rrcPerNB {
typedef struct NR_UE_RRC_INST_s {
instance_t ue_id;
rrcPerNB_t perNB[NB_CNX_UE];
bool access_barred;
rnti_t rnti;
uint32_t phyCellID;
long arfcn_ssb;
+1
View File
@@ -64,6 +64,7 @@ void *rrc_nrue(void *args_p);
void nr_rrc_handle_timers(NR_UE_RRC_INST_t *rrc);
void handle_rlf_detection(NR_UE_RRC_INST_t *rrc);
void handle_302_expired_stopped(NR_UE_RRC_INST_t *rrc);
/**\brief RRC NSA UE task.
\param void *args_p Pointer on arguments to start the task. */
@@ -144,6 +144,14 @@ void nr_rrc_handle_timers(NR_UE_RRC_INST_t *rrc)
nr_rrc_going_to_IDLE(rrc, RRC_CONNECTION_FAILURE, NULL);
}
bool t302_expired = nr_timer_tick(&timers->T302);
// 5.3.14.4 in 38.331
// consider the barring for this Access Category to be alleviated
if (t302_expired) {
LOG_W(NR_RRC, "Timer T302 expired! Access barring alleviated!\n");
handle_302_expired_stopped(rrc);
}
bool t304_expired = nr_timer_tick(&timers->T304);
if(t304_expired) {
LOG_W(NR_RRC, "Timer T304 expired\n");