From df1f8836b1bc84fc53a68dc7b46ff189b2358254 Mon Sep 17 00:00:00 2001 From: Francisco Paisana Date: Fri, 12 Jun 2020 11:48:42 +0100 Subject: [PATCH] fix issue #1418 by changing the ConRes CE scheduling mechanism --- srsenb/src/stack/mac/mac.cc | 12 +++++------- srsenb/src/stack/mac/scheduler_ue.cc | 1 - srsenb/src/stack/rrc/rrc_ue.cc | 5 +++++ 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/srsenb/src/stack/mac/mac.cc b/srsenb/src/stack/mac/mac.cc index cf0032d17..66831e3a4 100644 --- a/srsenb/src/stack/mac/mac.cc +++ b/srsenb/src/stack/mac/mac.cc @@ -36,10 +36,7 @@ using namespace asn1::rrc; namespace srsenb { -mac::mac() : - rar_pdu_msg(sched_interface::MAX_RAR_LIST), - rar_payload(), - common_buffers(SRSLTE_MAX_CARRIERS) +mac::mac() : rar_pdu_msg(sched_interface::MAX_RAR_LIST), rar_payload(), common_buffers(SRSLTE_MAX_CARRIERS) { pthread_rwlock_init(&rwlock, nullptr); } @@ -268,7 +265,6 @@ int mac::ue_set_crnti(uint16_t temp_crnti, uint16_t crnti, sched_interface::ue_c if (ret != SRSLTE_SUCCESS) { return ret; } - scheduler.dl_mac_buffer_state(crnti, (uint32_t)srslte::dl_sch_lcid::CON_RES_ID); return ret; } @@ -490,7 +486,7 @@ void mac::rach_detected(uint32_t tti, uint32_t enb_cc_idx, uint32_t preamble_idx Error("Ignoring RACH attempt. UE pool empty.\n"); } auto ue_ptr = ue_pool.wait_pop(); - uint16_t rnti = ue_ptr->get_rnti(); + uint16_t rnti = ue_ptr->get_rnti(); // Set PCAP if available if (pcap != nullptr) { @@ -517,7 +513,6 @@ void mac::rach_detected(uint32_t tti, uint32_t enb_cc_idx, uint32_t preamble_idx ue_cfg.supported_cc_list.emplace_back(); ue_cfg.supported_cc_list.back().active = true; ue_cfg.supported_cc_list.back().enb_cc_idx = enb_cc_idx; - ue_cfg.ue_bearers[0].direction = srsenb::sched_interface::ue_bearer_cfg_t::BOTH; ue_cfg.dl_cfg.tm = SRSLTE_TM1; if (scheduler.ue_cfg(rnti, ue_cfg) != SRSLTE_SUCCESS) { Error("Registering new user rnti=0x%x to SCHED\n", rnti); @@ -536,6 +531,9 @@ void mac::rach_detected(uint32_t tti, uint32_t enb_cc_idx, uint32_t preamble_idx // Trigger scheduler RACH scheduler.dl_rach_info(enb_cc_idx, rar_info); + // Schedule ConRes Msg4 + scheduler.dl_mac_buffer_state(rnti, (uint32_t)srslte::dl_sch_lcid::CON_RES_ID); + log_h->info("RACH: tti=%d, preamble=%d, offset=%d, temp_crnti=0x%x\n", tti, preamble_idx, time_adv, rnti); log_h->console("RACH: tti=%d, preamble=%d, offset=%d, temp_crnti=0x%x\n", tti, preamble_idx, time_adv, rnti); }); diff --git a/srsenb/src/stack/mac/scheduler_ue.cc b/srsenb/src/stack/mac/scheduler_ue.cc index 906d424e0..12bee5a14 100644 --- a/srsenb/src/stack/mac/scheduler_ue.cc +++ b/srsenb/src/stack/mac/scheduler_ue.cc @@ -879,7 +879,6 @@ std::pair sched_ue::get_requested_dl_bytes(uint32_t ue_cc_id // Ensure there is space for ConRes and RRC Setup // SRB0 is a special case due to being RLC TM (no segmentation possible) if (not bearer_is_dl(&lch[0])) { - log_h->error("SRB0 must always be activated for DL\n"); return {0, 0}; } if (not carriers[ue_cc_idx].is_active()) { diff --git a/srsenb/src/stack/rrc/rrc_ue.cc b/srsenb/src/stack/rrc/rrc_ue.cc index f4d78711f..e15e1b262 100644 --- a/srsenb/src/stack/rrc/rrc_ue.cc +++ b/srsenb/src/stack/rrc/rrc_ue.cc @@ -328,6 +328,11 @@ void rrc::ue::handle_rrc_con_setup_complete(rrc_conn_setup_complete_s* msg, srsl void rrc::ue::send_connection_reject() { + // Activate SRB0 if not yet activated + sched_interface::ue_bearer_cfg_t srb0{}; + srb0.direction = sched_interface::ue_bearer_cfg_t::DL; + parent->mac->bearer_ue_cfg(rnti, 0, &srb0); + dl_ccch_msg_s dl_ccch_msg; dl_ccch_msg.msg.set_c1().set_rrc_conn_reject().crit_exts.set_c1().set_rrc_conn_reject_r8().wait_time = 10; send_dl_ccch(&dl_ccch_msg);