Changed NAS is_attached interface to is_registered.

master
Pedro Alvarez 5 years ago committed by Andre Puschmann
parent 5649ecaab0
commit 604e79214d

@ -224,7 +224,7 @@ public:
virtual void left_rrc_connected() = 0; virtual void left_rrc_connected() = 0;
virtual void set_barring(srslte::barring_t barring) = 0; virtual void set_barring(srslte::barring_t barring) = 0;
virtual bool paging(srslte::s_tmsi_t* ue_identity) = 0; virtual bool paging(srslte::s_tmsi_t* ue_identity) = 0;
virtual bool is_attached() = 0; virtual bool is_registered() = 0;
virtual void write_pdu(uint32_t lcid, srslte::unique_byte_buffer_t pdu) = 0; virtual void write_pdu(uint32_t lcid, srslte::unique_byte_buffer_t pdu) = 0;
virtual uint32_t get_k_enb_count() = 0; virtual uint32_t get_k_enb_count() = 0;
virtual bool get_k_asme(uint8_t* k_asme_, uint32_t n) = 0; virtual bool get_k_asme(uint8_t* k_asme_, uint32_t n) = 0;
@ -623,7 +623,7 @@ public:
class stack_interface_gw : public pdcp_interface_gw class stack_interface_gw : public pdcp_interface_gw
{ {
public: public:
virtual bool is_attached() = 0; virtual bool is_registered() = 0;
virtual bool start_service_request() = 0; virtual bool start_service_request() = 0;
}; };

@ -66,7 +66,7 @@ public:
bool get_metrics(srsenb::stack_metrics_t* metrics) final; bool get_metrics(srsenb::stack_metrics_t* metrics) final;
// GW srsue stack_interface_gw dummy interface // GW srsue stack_interface_gw dummy interface
bool is_attached(){return true;}; bool is_registered(){return true;};
bool start_service_request(){return true;}; bool start_service_request(){return true;};
// PHY->MAC interface // PHY->MAC interface

@ -68,7 +68,7 @@ public:
int init(const stack_args_t& args_, srslte::logger* logger_, phy_interface_stack_lte* phy_, gw_interface_stack* gw_); int init(const stack_args_t& args_, srslte::logger* logger_, phy_interface_stack_lte* phy_, gw_interface_stack* gw_);
bool switch_on() final; bool switch_on() final;
bool switch_off() final; bool switch_off() final;
bool is_attached() final; bool is_registered() final;
bool start_service_request() final; bool start_service_request() final;
bool enable_data(); bool enable_data();
bool disable_data(); bool disable_data();

@ -71,7 +71,7 @@ public:
void stop(); void stop();
// GW srsue stack_interface_gw dummy interface // GW srsue stack_interface_gw dummy interface
bool is_attached(){return true;}; bool is_registered(){return true;};
bool start_service_request(){return true;}; bool start_service_request(){return true;};
bool get_metrics(stack_metrics_t* metrics); bool get_metrics(stack_metrics_t* metrics);

@ -72,7 +72,7 @@ public:
void start_service_request(srslte::establishment_cause_t cause_); void start_service_request(srslte::establishment_cause_t cause_);
// Stack+RRC interface // Stack+RRC interface
bool is_attached() override; bool is_registered() override;
// timer callback // timer callback
void timer_expired(uint32_t timeout_id) override; void timer_expired(uint32_t timeout_id) override;

@ -1175,7 +1175,7 @@ proc_outcome_t rrc::go_idle_proc::step()
void rrc::go_idle_proc::then(const srslte::proc_state_t& result) void rrc::go_idle_proc::then(const srslte::proc_state_t& result)
{ {
if (rrc_ptr->nas->is_attached() and not rrc_ptr->cell_reselector.launch()) { if (rrc_ptr->nas->is_registered() and not rrc_ptr->cell_reselector.launch()) {
rrc_ptr->rrc_log->error("Failed to initiate a Cell Reselection procedure...\n"); rrc_ptr->rrc_log->error("Failed to initiate a Cell Reselection procedure...\n");
return; return;
} }
@ -1245,7 +1245,7 @@ proc_outcome_t rrc::cell_reselection_proc::step()
void rrc::cell_reselection_proc::then(const srslte::proc_state_t& result) void rrc::cell_reselection_proc::then(const srslte::proc_state_t& result)
{ {
// Schedule cell reselection periodically, while rrc is idle // Schedule cell reselection periodically, while rrc is idle
if (not rrc_ptr->is_connected() and rrc_ptr->nas->is_attached()) { if (not rrc_ptr->is_connected() and rrc_ptr->nas->is_registered()) {
if (cell_sel_result == cs_result_t::changed_cell) { if (cell_sel_result == cs_result_t::changed_cell) {
// TS 36.304 5.2.4.6 - Intra-frequency and equal priority inter-frequency Cell Reselection criteria // TS 36.304 5.2.4.6 - Intra-frequency and equal priority inter-frequency Cell Reselection criteria
// the UE shall reselect a new cell if more than 1 second has elapsed since the UE camped // the UE shall reselect a new cell if more than 1 second has elapsed since the UE camped

@ -262,9 +262,9 @@ void ue_stack_lte::write_sdu(uint32_t lcid, srslte::unique_byte_buffer_t sdu)
* Check whether nas is attached * Check whether nas is attached
* @return bool wether NAS is in EMM_REGISTERED * @return bool wether NAS is in EMM_REGISTERED
*/ */
bool ue_stack_lte::is_attached() bool ue_stack_lte::is_registered()
{ {
return nas.is_attached(); return nas.is_registered();
} }
/******************** /********************

@ -221,8 +221,8 @@ void gw::run_thread()
return; return;
} }
const static uint32_t ATTACH_WAIT_TOUT = 40, SERVICE_WAIT_TOUT = 40; // 4 sec const static uint32_t REGISTER_WAIT_TOUT = 40, SERVICE_WAIT_TOUT = 40; // 4 sec
uint32_t attach_wait = 0, service_wait = 0; uint32_t register_wait = 0, service_wait = 0;
log.info("GW IP packet receiver thread run_enable\n"); log.info("GW IP packet receiver thread run_enable\n");
@ -264,24 +264,25 @@ void gw::run_thread()
log.info_hex(pdu->msg, pdu->N_bytes, "TX PDU"); log.info_hex(pdu->msg, pdu->N_bytes, "TX PDU");
// Make sure UE is attached // Make sure UE is attached
while (run_enable && !stack->is_attached() && attach_wait < ATTACH_WAIT_TOUT) { while (run_enable && !stack->is_registered() && register_wait < REGISTER_WAIT_TOUT) {
if (!attach_wait) { if (!register_wait) {
log.info("UE is not attached, waiting for NAS attach (%d/%d)\n", attach_wait, ATTACH_WAIT_TOUT); log.info("UE is not attached, waiting for NAS attach (%d/%d)\n", register_wait, REGISTER_WAIT_TOUT);
} }
usleep(100000); usleep(100000);
attach_wait++; register_wait++;
} }
attach_wait = 0; register_wait = 0;
// If we are still not attached by this stage, drop packet // If we are still not attached by this stage, drop packet
if (run_enable && !stack->is_attached()) { if (run_enable && !stack->is_registered()) {
continue; continue;
} }
// Wait for service request if necessary // Wait for service request if necessary
while (run_enable && !stack->is_lcid_enabled(default_lcid) && service_wait < SERVICE_WAIT_TOUT) { while (run_enable && !stack->is_lcid_enabled(default_lcid) && service_wait < SERVICE_WAIT_TOUT) {
if (!service_wait) { if (!service_wait) {
log.info("UE does not have service, waiting for NAS service request (%d/%d)\n", service_wait, SERVICE_WAIT_TOUT); log.info(
"UE does not have service, waiting for NAS service request (%d/%d)\n", service_wait, SERVICE_WAIT_TOUT);
stack->start_service_request(); stack->start_service_request();
} }
usleep(100000); usleep(100000);

@ -261,7 +261,7 @@ void nas::timer_expired(uint32_t timeout_id)
/******************************************************************************* /*******************************************************************************
* UE Stack and RRC common Interface * UE Stack and RRC common Interface
******************************************************************************/ ******************************************************************************/
bool nas::is_attached() bool nas::is_registered()
{ {
return state.get_state() == emm_state_t::state_t::registered; return state.get_state() == emm_state_t::state_t::registered;
} }

@ -158,7 +158,7 @@ public:
void write_sdu(uint32_t lcid, srslte::unique_byte_buffer_t sdu) { pdcp->write_sdu(lcid, std::move(sdu)); } void write_sdu(uint32_t lcid, srslte::unique_byte_buffer_t sdu) { pdcp->write_sdu(lcid, std::move(sdu)); }
bool is_lcid_enabled(uint32_t lcid) { return pdcp->is_lcid_enabled(lcid); } bool is_lcid_enabled(uint32_t lcid) { return pdcp->is_lcid_enabled(lcid); }
bool is_attached() { return true; } bool is_registered() { return true; }
bool start_service_request() { return true; } bool start_service_request() { return true; }
@ -310,7 +310,7 @@ int mme_attach_request_test()
gw.init(gw_args, g_logger, &stack); gw.init(gw_args, g_logger, &stack);
stack.init(&nas); stack.init(&nas);
usleep(1000); // Wait for stack to initialize before stoping it. usleep(5000); // Wait for stack to initialize before stoping it.
// trigger test // trigger test
stack.switch_on(); stack.switch_on();
stack.stop(); stack.stop();

@ -174,7 +174,7 @@ class nas_test : public srsue::nas
{ {
public: public:
nas_test(srslte::task_sched_handle t) : srsue::nas(t) {} nas_test(srslte::task_sched_handle t) : srsue::nas(t) {}
bool is_attached() override { return false; } bool is_registered() override { return false; }
}; };
class pdcp_test : public srslte::pdcp class pdcp_test : public srslte::pdcp

Loading…
Cancel
Save