From 47135cb75bd22da430f97b3ca00ac0331483526c Mon Sep 17 00:00:00 2001 From: Pedro Alvarez Date: Wed, 31 Mar 2021 15:47:10 +0100 Subject: [PATCH] Changed counting of KOs to RRC --- srsenb/hdr/enb.h | 1 + srsenb/hdr/stack/rrc/rrc.h | 11 ++++++----- srsenb/hdr/stack/rrc/rrc_config.h | 1 + srsenb/hdr/stack/rrc/rrc_ue.h | 4 ++++ srsenb/src/enb_cfg_parser.cc | 3 +++ srsenb/src/main.cc | 2 +- srsenb/src/stack/mac/mac.cc | 8 ++------ srsenb/src/stack/rrc/rrc.cc | 6 +++++- srsenb/src/stack/rrc/rrc_ue.cc | 19 ++++++++++++++++++- 9 files changed, 41 insertions(+), 14 deletions(-) diff --git a/srsenb/hdr/enb.h b/srsenb/hdr/enb.h index 04476d651..97e7b16d7 100644 --- a/srsenb/hdr/enb.h +++ b/srsenb/hdr/enb.h @@ -93,6 +93,7 @@ struct general_args_t { std::string tracing_filename; std::string eia_pref_list; std::string eea_pref_list; + uint32_t max_mac_dl_kos; }; struct all_args_t { diff --git a/srsenb/hdr/stack/rrc/rrc.h b/srsenb/hdr/stack/rrc/rrc.h index f1c62909f..9614b856b 100644 --- a/srsenb/hdr/stack/rrc/rrc.h +++ b/srsenb/hdr/stack/rrc/rrc.h @@ -181,11 +181,12 @@ private: srsran::unique_byte_buffer_t pdu; } rrc_pdu; - const static uint32_t LCID_EXIT = 0xffff0000; - const static uint32_t LCID_REM_USER = 0xffff0001; - const static uint32_t LCID_REL_USER = 0xffff0002; - const static uint32_t LCID_ACT_USER = 0xffff0004; - const static uint32_t LCID_RTX_USER = 0xffff0005; + const static uint32_t LCID_EXIT = 0xffff0000; + const static uint32_t LCID_REM_USER = 0xffff0001; + const static uint32_t LCID_REL_USER = 0xffff0002; + const static uint32_t LCID_ACT_USER = 0xffff0004; + const static uint32_t LCID_RTX_USER = 0xffff0005; + const static uint32_t LCID_MAC_KO_USER = 0xffff0006; bool running = false; srsran::dyn_blocking_queue rx_pdu_queue; diff --git a/srsenb/hdr/stack/rrc/rrc_config.h b/srsenb/hdr/stack/rrc/rrc_config.h index 5ce1562e2..dc25d3930 100644 --- a/srsenb/hdr/stack/rrc/rrc_config.h +++ b/srsenb/hdr/stack/rrc/rrc_config.h @@ -59,6 +59,7 @@ struct rrc_cfg_t { srsran_cell_t cell; cell_list_t cell_list; cell_list_t cell_list_nr; + uint32_t max_mac_dl_kos; }; constexpr uint32_t UE_PCELL_CC_IDX = 0; diff --git a/srsenb/hdr/stack/rrc/rrc_ue.h b/srsenb/hdr/stack/rrc/rrc_ue.h index c442194f3..b4bfd2b72 100644 --- a/srsenb/hdr/stack/rrc/rrc_ue.h +++ b/srsenb/hdr/stack/rrc/rrc_ue.h @@ -41,6 +41,7 @@ public: std::string to_string(const activity_timeout_type_t& type); void set_activity_timeout(const activity_timeout_type_t type); void set_activity(); + void mac_ko_activity(); void activity_timer_expired(const activity_timeout_type_t type); void max_retx_reached(); @@ -182,6 +183,9 @@ private: const static uint32_t UE_PCELL_CC_IDX = 0; + uint32_t consecutive_kos = 0; + uint32_t max_mac_dl_retx; + ue_cell_ded_list ue_cell_list; bearer_cfg_handler bearer_list; security_cfg_handler ue_security_cfg; diff --git a/srsenb/src/enb_cfg_parser.cc b/srsenb/src/enb_cfg_parser.cc index cc55e202d..5ff642282 100644 --- a/srsenb/src/enb_cfg_parser.cc +++ b/srsenb/src/enb_cfg_parser.cc @@ -1135,6 +1135,9 @@ int set_derived_args(all_args_t* args_, rrc_cfg_t* rrc_cfg_, phy_cfg_t* phy_cfg_ // RRC needs eNB id for SIB1 packing rrc_cfg_->enb_id = args_->stack.s1ap.enb_id; + // Set max number of KOs + rrc_cfg_->max_mac_dl_kos = args_->general.max_mac_dl_kos; + // Set sync queue capacity to 1 for ZMQ if (args_->rf.device_name == "zmq") { srslog::fetch_basic_logger("ENB").info("Using sync queue size of one for ZMQ based radio."); diff --git a/srsenb/src/main.cc b/srsenb/src/main.cc index 2dde864ca..d36ee15d1 100644 --- a/srsenb/src/main.cc +++ b/srsenb/src/main.cc @@ -214,7 +214,7 @@ void parse_args(all_args_t* args, int argc, char* argv[]) ("expert.eea_pref_list", bpo::value(&args->general.eea_pref_list)->default_value("EEA0, EEA2, EEA1"), "Ordered preference list for the selection of encryption algorithm (EEA) (default: EEA0, EEA2, EEA1).") ("expert.eia_pref_list", bpo::value(&args->general.eia_pref_list)->default_value("EIA2, EIA1, EIA0"), "Ordered preference list for the selection of integrity algorithm (EIA) (default: EIA2, EIA1, EIA0).") ("expert.max_nof_ues", bpo::value(&args->stack.mac.max_nof_ues)->default_value(64), "Maximum number of connected UEs") - ("expert.max_nof_kos", bpo::value(&args->stack.mac.max_nof_kos)->default_value(254), "Maximum number of consecutive KOs before triggering the UE's release") + ("expert.max_mac_dl_kos", bpo::value(&args->general.max_mac_dl_kos)->default_value(30), "Maximum number of consecutive KOs before triggering the UE's release") // eMBMS section ("embms.enable", bpo::value(&args->stack.embms.enable)->default_value(false), "Enables MBMS in the eNB") diff --git a/srsenb/src/stack/mac/mac.cc b/srsenb/src/stack/mac/mac.cc index 05002e1ab..45369e65d 100644 --- a/srsenb/src/stack/mac/mac.cc +++ b/srsenb/src/stack/mac/mac.cc @@ -292,17 +292,13 @@ int mac::ack_info(uint32_t tti_rx, uint16_t rnti, uint32_t enb_cc_idx, uint32_t ue_db[rnti]->metrics_tx(ack, nof_bytes); if (ack) { - ue_db[rnti]->ko_counter = 0; if (nof_bytes > 64) { // do not count RLC status messages only rrc_h->set_activity_user(rnti, true); logger.info("DL activity rnti=0x%x, n_bytes=%d", rnti, nof_bytes); } } else { - ue_db[rnti]->ko_counter++; - if (ue_db[rnti]->ko_counter > args.max_nof_kos) { - rrc_h->set_activity_user(rnti, false); - logger.info("DL max KOs reached rnti=0x%x, n_bytes=%d", rnti, nof_bytes); - } + rrc_h->set_activity_user(rnti, false); + logger.info("DL KO activity rnti=0x%x, n_bytes=%d", rnti, nof_bytes); } return SRSRAN_SUCCESS; } diff --git a/srsenb/src/stack/rrc/rrc.cc b/srsenb/src/stack/rrc/rrc.cc index 400785e64..3345c1c28 100644 --- a/srsenb/src/stack/rrc/rrc.cc +++ b/srsenb/src/stack/rrc/rrc.cc @@ -85,6 +85,7 @@ int32_t rrc::init(const rrc_cfg_t& cfg_, "re-establishment procedure."); } logger.info("Inactivity timeout: %d ms", cfg.inactivity_timeout_ms); + logger.info("Max consecutive MAC KOs: %d", cfg.max_mac_dl_kos); running = true; @@ -137,7 +138,7 @@ void rrc::set_activity_user(uint16_t rnti, bool ack_info) if (ack_info) { p = {rnti, LCID_ACT_USER, nullptr}; } else { - p = {rnti, LCID_RTX_USER, nullptr}; + p = {rnti, LCID_MAC_KO_USER, nullptr}; } if (not rx_pdu_queue.try_push(std::move(p))) { @@ -1025,6 +1026,9 @@ void rrc::tti_clock() case LCID_ACT_USER: user_it->second->set_activity(); break; + case LCID_MAC_KO_USER: + user_it->second->mac_ko_activity(); + break; case LCID_RTX_USER: user_it->second->max_retx_reached(); break; diff --git a/srsenb/src/stack/rrc/rrc_ue.cc b/srsenb/src/stack/rrc/rrc_ue.cc index 74b6b9757..0ca293692 100644 --- a/srsenb/src/stack/rrc/rrc_ue.cc +++ b/srsenb/src/stack/rrc/rrc_ue.cc @@ -103,12 +103,29 @@ void rrc::ue::set_activity() { // re-start activity timer with current timeout value activity_timer.run(); + consecutive_kos = 0; if (parent) { parent->logger.debug("Activity registered for rnti=0x%x (timeout_value=%dms)", rnti, activity_timer.duration()); } } -void rrc::ue::activity_timer_expired(activity_timeout_type_t type) +void rrc::ue::mac_ko_activity() +{ + // Count KOs in MAC and trigger release if it goes above a certain value. + // This is done to detect out-of-coverage UEs + consecutive_kos++; + parent->logger.debug("KO activity registered for rnti=0x%x (consecutive_kos=%d, max_mac_dl_kos=%d)", + rnti, + consecutive_kos, + parent->cfg.max_mac_dl_kos); + + if (consecutive_kos > parent->cfg.max_mac_dl_kos) { + parent->logger.debug("Max KOs reached, triggering release rnti=0x%x", rnti); + max_retx_reached(); + } +} + +void rrc::ue::activity_timer_expired(const activity_timeout_type_t type) { if (parent) { parent->logger.info("Activity timer for rnti=0x%x expired after %d ms", rnti, activity_timer.time_elapsed());