nas: adding t3402 to restart attach after initial attach attempt counter expired

master
Andre Puschmann 5 years ago
parent 7ef56cb637
commit 15c47fab56

@ -133,12 +133,14 @@ private:
// timers // timers
srsue::task_handler_interface_lte* task_handler = nullptr; srsue::task_handler_interface_lte* task_handler = nullptr;
srslte::timer_handler::unique_timer t3402; // started when attach attempt counter reached 5
srslte::timer_handler::unique_timer t3410; // started when attach request is sent, on expiry, start t3411 srslte::timer_handler::unique_timer t3410; // started when attach request is sent, on expiry, start t3411
srslte::timer_handler::unique_timer t3411; // started when attach failed srslte::timer_handler::unique_timer t3411; // started when attach failed
srslte::timer_handler::unique_timer t3421; // started when detach request is sent srslte::timer_handler::unique_timer t3421; // started when detach request is sent
srslte::timer_handler::unique_timer reattach_timer; // started to trigger delayed re-attach srslte::timer_handler::unique_timer reattach_timer; // started to trigger delayed re-attach
// Values according to TS 24.301 Sec 10.2 // Values according to TS 24.301 Sec 10.2
const uint32_t t3402_duration_ms = 12 * 60 * 1000; // 12m
const uint32_t t3410_duration_ms = 15 * 1000; // 15s const uint32_t t3410_duration_ms = 15 * 1000; // 15s
const uint32_t t3411_duration_ms = 10 * 1000; // 10s const uint32_t t3411_duration_ms = 10 * 1000; // 10s
const uint32_t t3421_duration_ms = 15 * 1000; // 15s const uint32_t t3421_duration_ms = 15 * 1000; // 15s

@ -240,6 +240,7 @@ nas::nas(srsue::stack_interface_nas* task_handler_) :
plmn_searcher(this), plmn_searcher(this),
rrc_connector(this), rrc_connector(this),
task_handler(task_handler_), task_handler(task_handler_),
t3402(task_handler_->get_unique_timer()),
t3410(task_handler_->get_unique_timer()), t3410(task_handler_->get_unique_timer()),
t3411(task_handler_->get_unique_timer()), t3411(task_handler_->get_unique_timer()),
t3421(task_handler_->get_unique_timer()), t3421(task_handler_->get_unique_timer()),
@ -297,6 +298,7 @@ void nas::init(usim_interface_nas* usim_, rrc_interface_nas* rrc_, gw_interface_
} }
// Configure timers // Configure timers
t3402.set(t3402_duration_ms, [this](uint32_t tid) { timer_expired(tid); });
t3410.set(t3410_duration_ms, [this](uint32_t tid) { timer_expired(tid); }); t3410.set(t3410_duration_ms, [this](uint32_t tid) { timer_expired(tid); });
t3411.set(t3411_duration_ms, [this](uint32_t tid) { timer_expired(tid); }); t3411.set(t3411_duration_ms, [this](uint32_t tid) { timer_expired(tid); });
t3421.set(t3421_duration_ms, [this](uint32_t tid) { timer_expired(tid); }); t3421.set(t3421_duration_ms, [this](uint32_t tid) { timer_expired(tid); });
@ -333,19 +335,24 @@ void nas::run_tti()
void nas::timer_expired(uint32_t timeout_id) void nas::timer_expired(uint32_t timeout_id)
{ {
if (timeout_id == t3410.id()) { if (timeout_id == t3402.id()) {
nas_log->info("Timer T3402 expired: trying to attach again\n");
start_attach_request(nullptr, srslte::establishment_cause_t::mo_sig);
} else if (timeout_id == t3410.id()) {
// Section 5.5.1.2.6 case c) // Section 5.5.1.2.6 case c)
attach_attempt_counter++; attach_attempt_counter++;
nas_log->info("Timer T3410 expired: starting T3411 (attempt %d/%d)\n", attach_attempt_counter, max_attach_attempts); nas_log->info("Timer T3410 expired after attach attempt %d/%d: starting T3411)\n",
attach_attempt_counter,
max_attach_attempts);
if (attach_attempt_counter < max_attach_attempts) { if (attach_attempt_counter < max_attach_attempts) {
// start T3411, ToDo: EMM-DEREGISTERED.ATTEMPTING-TO-ATTACH isn't fully implemented yet // start T3411, ToDo: EMM-DEREGISTERED.ATTEMPTING-TO-ATTACH isn't fully implemented yet
t3411.run(); t3411.run();
} else { } else {
// maximum attach attempts reached, cleanup current state and try again // maximum attach attempts reached
enter_emm_deregistered(); enter_emm_deregistered();
start_attach_request(nullptr, srslte::establishment_cause_t::mo_sig); t3402.run();
} }
} else if (timeout_id == t3411.id()) { } else if (timeout_id == t3411.id()) {
nas_log->info("Timer T3411 expired: trying to attach again\n"); nas_log->info("Timer T3411 expired: trying to attach again\n");
@ -386,7 +393,10 @@ void nas::start_attach_request(srslte::proc_state_t* result, srslte::establishme
t3411.stop(); t3411.stop();
} }
// Todo: stop T3402 // stop T3402
if (t3402.is_running()) {
t3402.stop();
}
// Search PLMN is not selected // Search PLMN is not selected
if (!plmn_is_selected) { if (!plmn_is_selected) {
@ -455,17 +465,14 @@ void nas::plmn_search_completed(const rrc_interface_nas::found_plmn_t found_plmn
bool nas::detach_request(const bool switch_off) bool nas::detach_request(const bool switch_off)
{ {
switch (state) { switch (state) {
case EMM_STATE_DEREGISTERED:
// do nothing ..
break;
case EMM_STATE_REGISTERED: case EMM_STATE_REGISTERED:
// send detach request // send detach request
send_detach_request(switch_off); send_detach_request(switch_off);
break; break;
case EMM_STATE_DEREGISTERED:
case EMM_STATE_DEREGISTERED_INITIATED: case EMM_STATE_DEREGISTERED_INITIATED:
// do nothing ..
break;
default: default:
nas_log->debug("Received request to detach in state %s\n", emm_state_text[state]);
break; break;
} }
return false; return false;

Loading…
Cancel
Save