From c2e9817f4187afec4942ba7735c13b0dc4b3976b Mon Sep 17 00:00:00 2001 From: Ismael Gomez Date: Wed, 5 Jun 2019 12:59:24 +0200 Subject: [PATCH] Possible solution to RLC Reestablishment --- lib/include/srslte/interfaces/ue_interfaces.h | 1 + lib/src/upper/rlc.cc | 2 +- srsue/hdr/stack/rrc/rrc.h | 1 + srsue/src/stack/mac/mux.cc | 3 ++ srsue/src/stack/rrc/rrc.cc | 45 ++++++++++++++++--- 5 files changed, 45 insertions(+), 7 deletions(-) diff --git a/lib/include/srslte/interfaces/ue_interfaces.h b/lib/include/srslte/interfaces/ue_interfaces.h index 7e03d7723..afc583efc 100644 --- a/lib/include/srslte/interfaces/ue_interfaces.h +++ b/lib/include/srslte/interfaces/ue_interfaces.h @@ -284,6 +284,7 @@ public: virtual void add_bearer(uint32_t lcid, srslte::srslte_rlc_config_t cnfg) = 0; virtual void add_bearer_mrb(uint32_t lcid) = 0; virtual void del_bearer(uint32_t lcid) = 0; + virtual void resume_bearer(uint32_t lcid) = 0; virtual void change_lcid(uint32_t old_lcid, uint32_t new_lcid) = 0; virtual bool has_bearer(uint32_t lcid) = 0; virtual bool has_data(const uint32_t lcid) = 0; diff --git a/lib/src/upper/rlc.cc b/lib/src/upper/rlc.cc index 6f2354989..dc44c58fb 100644 --- a/lib/src/upper/rlc.cc +++ b/lib/src/upper/rlc.cc @@ -567,7 +567,7 @@ void rlc::resume_bearer(uint32_t lcid) { pthread_rwlock_wrlock(&rwlock); - if (not valid_lcid(lcid)) { + if (valid_lcid(lcid)) { // Need to call init again because timers have been destroyed rlc_array.at(lcid)->init(rlc_log, lcid, pdcp, rrc, mac_timers); diff --git a/srsue/hdr/stack/rrc/rrc.h b/srsue/hdr/stack/rrc/rrc.h index 1132599d1..330314a23 100644 --- a/srsue/hdr/stack/rrc/rrc.h +++ b/srsue/hdr/stack/rrc/rrc.h @@ -473,6 +473,7 @@ private: bool go_idle; asn1::rrc::reest_cause_e m_reest_cause; uint16_t m_reest_rnti; + bool reestablishment_successful; uint32_t rlc_flush_counter; uint32_t rlc_flush_timeout; diff --git a/srsue/src/stack/mac/mux.cc b/srsue/src/stack/mac/mux.cc index 033094d45..a2d09b8c8 100644 --- a/srsue/src/stack/mac/mux.cc +++ b/srsue/src/stack/mac/mux.cc @@ -170,6 +170,9 @@ uint8_t* mux::pdu_get(uint8_t* payload, uint32_t pdu_sz, uint32_t pid) } } } else { + if (pending_crnti_ce) { + Warning("Pending C-RNTI CE was not inserted because message was for CCCH\n"); + } is_rar = true; } pending_crnti_ce = 0; diff --git a/srsue/src/stack/rrc/rrc.cc b/srsue/src/stack/rrc/rrc.cc index 74221715e..0488d2d39 100644 --- a/srsue/src/stack/rrc/rrc.cc +++ b/srsue/src/stack/rrc/rrc.cc @@ -63,6 +63,7 @@ rrc::rrc() : go_idle = false; m_reest_cause = asn1::rrc::reest_cause_e::nulltype; m_reest_rnti = 0; + reestablishment_successful = false; current_mac_cfg = {}; previous_mac_cfg = {}; @@ -1307,6 +1308,7 @@ void rrc::send_con_restablish_request() // Clean reestablishment type asn1::rrc::reest_cause_e cause = m_reest_cause; m_reest_cause = asn1::rrc::reest_cause_e::nulltype; + reestablishment_successful = false; if (cause == asn1::rrc::reest_cause_e::ho_fail) { crnti = ho_src_rnti; @@ -1583,6 +1585,20 @@ bool rrc::con_reconfig_ho(asn1::rrc::rrc_conn_recfg_s* reconfig) bool rrc::con_reconfig(asn1::rrc::rrc_conn_recfg_s* reconfig) { asn1::rrc::rrc_conn_recfg_r8_ies_s* reconfig_r8 = &reconfig->crit_exts.c1().rrc_conn_recfg_r8(); + + // If this is the first con_reconfig after a reestablishment + if (reestablishment_successful) { + // Reestablish PDCP and RLC for SRB2 and all DRB + // FIXME: Which is the maximum LCID? + for (int i = 2; i < SRSLTE_N_RADIO_BEARERS; i++) { + if (rlc->has_bearer(i)) { + pdcp->reestablish(i); + rlc->reestablish(i); + } + } + } + + // Apply RR config as in 5.3.10 if (reconfig_r8->rr_cfg_ded_present) { if (!apply_rr_config_dedicated(&reconfig_r8->rr_cfg_ded)) { return false; @@ -1620,6 +1636,17 @@ bool rrc::con_reconfig(asn1::rrc::rrc_conn_recfg_s* reconfig) } } } + + // If first message after reestablishment, resume SRB2 and all DRB + if (reestablishment_successful) { + reestablishment_successful = false; + for (int i = 2; i < SRSLTE_N_RADIO_BEARERS; i++) { + if (rlc->has_bearer(i)) { + rlc->resume_bearer(i); + } + } + } + if (reconfig_r8->meas_cfg_present) { if (!measurements.parse_meas_config(&reconfig_r8->meas_cfg)) { return false; @@ -1762,9 +1789,8 @@ void rrc::init_con_restablish_request(asn1::rrc::reest_cause_e cause) mac_timers->timer_get(t311)->reset(); mac_timers->timer_get(t311)->run(); - // suspend all RBs except SRB0; - // rlc->reestablish(); - // pdcp->reset(); + // TODO: suspend all RBs except SRB0; + // is this that RLC tx queue stops accepting SDUs? // reset MAC; mac->reset(); @@ -2589,7 +2615,7 @@ void rrc::log_phy_config_dedicated() phys_cfg_ded_s* current_cfg = ¤t_phy_cfg.dedicated; if (current_cfg->pdsch_cfg_ded_present) { - rrc_log->info("Set PDSCH-Config=%s (present)\n", current_cfg->pdsch_cfg_ded.p_a.to_string().c_str()); + rrc_log->info("Set PDSCH-Config p_a=%s\n", current_cfg->pdsch_cfg_ded.p_a.to_string().c_str()); } if (current_cfg->cqi_report_cfg_present) { @@ -2904,8 +2930,9 @@ void rrc::handle_con_reest(rrc_conn_reest_s* setup) mac_timers->timer_get(t301)->stop(); - pdcp->reestablish(); - rlc->reestablish(); + // Reestablish PDCP and RLC for SRB1 + pdcp->reestablish(1); + rlc->reestablish(1); // Update RRC Integrity keys int ncc = setup->crit_exts.c1().rrc_conn_reest_r8().next_hop_chaining_count; @@ -2923,8 +2950,13 @@ void rrc::handle_con_reest(rrc_conn_reest_s* setup) // Apply the Radio Resource configuration apply_rr_config_dedicated(&setup->crit_exts.c1().rrc_conn_reest_r8().rr_cfg_ded); + // Resume SRB1 (if already configured in rr_config, this function does nothing) + rlc->resume_bearer(0); + // Send ConnectionSetupComplete message send_con_restablish_complete(); + + reestablishment_successful = true; } void rrc::add_srb(srb_to_add_mod_s* srb_cnfg) @@ -3077,6 +3109,7 @@ void rrc::set_phy_default_pucch_srs() current_phy_cfg.dedicated.srs_ul_cfg_ded_present = false; current_phy_cfg.dedicated.sched_request_cfg_present = false; + rrc_log->info("Setting default PHY config dedicated\n"); set_phy_config_dedicated_default(); }