From 49279c89d8375d62e01dc7cd0c50b01028eff21f Mon Sep 17 00:00:00 2001 From: Andre Puschmann Date: Thu, 8 Aug 2019 11:15:44 +0200 Subject: [PATCH] send DL-DCCH on SRB2 after it has been established --- lib/include/srslte/interfaces/enb_interfaces.h | 1 + srsenb/hdr/stack/upper/rlc.h | 1 + srsenb/src/stack/rrc/rrc.cc | 9 +++++++-- srsenb/src/stack/upper/rlc.cc | 11 +++++++++++ 4 files changed, 20 insertions(+), 2 deletions(-) diff --git a/lib/include/srslte/interfaces/enb_interfaces.h b/lib/include/srslte/interfaces/enb_interfaces.h index 749e626f1..743d838b8 100644 --- a/lib/include/srslte/interfaces/enb_interfaces.h +++ b/lib/include/srslte/interfaces/enb_interfaces.h @@ -194,6 +194,7 @@ public: virtual void add_bearer(uint16_t rnti, uint32_t lcid, srslte::rlc_config_t cnfg) = 0; virtual void add_bearer_mrb(uint16_t rnti, uint32_t lcid) = 0; virtual void write_sdu(uint16_t rnti, uint32_t lcid, srslte::unique_byte_buffer_t sdu) = 0; + virtual bool has_bearer(uint16_t rnti, uint32_t lcid) = 0; }; // PDCP interface for GTPU diff --git a/srsenb/hdr/stack/upper/rlc.h b/srsenb/hdr/stack/upper/rlc.h index 234eebb1a..f4b8e325c 100644 --- a/srsenb/hdr/stack/upper/rlc.h +++ b/srsenb/hdr/stack/upper/rlc.h @@ -54,6 +54,7 @@ public: void rem_user(uint16_t rnti); void add_bearer(uint16_t rnti, uint32_t lcid, srslte::rlc_config_t cnfg); void add_bearer_mrb(uint16_t rnti, uint32_t lcid); + bool has_bearer(uint16_t rnti, uint32_t lcid); // rlc_interface_pdcp void write_sdu(uint16_t rnti, uint32_t lcid, srslte::unique_byte_buffer_t sdu); diff --git a/srsenb/src/stack/rrc/rrc.cc b/srsenb/src/stack/rrc/rrc.cc index c98a5ea08..90035b33f 100644 --- a/srsenb/src/stack/rrc/rrc.cc +++ b/srsenb/src/stack/rrc/rrc.cc @@ -2094,10 +2094,15 @@ void rrc::ue::send_dl_dcch(dl_dcch_msg_s* dl_dcch_msg, srslte::unique_byte_buffe dl_dcch_msg->pack(bref); pdu->N_bytes = 1u + (uint32_t)bref.distance_bytes(pdu->msg); + // send on SRB2 if user is fully registered (after RRC reconfig complete) + uint32_t lcid = + parent->rlc->has_bearer(rnti, RB_ID_SRB2) && state == RRC_STATE_REGISTERED ? RB_ID_SRB2 : RB_ID_SRB1; + char buf[32] = {}; - sprintf(buf, "SRB1 - rnti=0x%x", rnti); + sprintf(buf, "SRB%d - rnti=0x%x", lcid, rnti); parent->log_rrc_message(buf, Tx, pdu.get(), *dl_dcch_msg); - parent->pdcp->write_sdu(rnti, RB_ID_SRB1, std::move(pdu)); + + parent->pdcp->write_sdu(rnti, lcid, std::move(pdu)); } else { parent->rrc_log->error("Allocating pdu\n"); } diff --git a/srsenb/src/stack/upper/rlc.cc b/srsenb/src/stack/upper/rlc.cc index ecf0cc40d..40f6856f8 100644 --- a/srsenb/src/stack/upper/rlc.cc +++ b/srsenb/src/stack/upper/rlc.cc @@ -110,6 +110,17 @@ void rlc::add_bearer_mrb(uint16_t rnti, uint32_t lcid) pthread_rwlock_unlock(&rwlock); } +bool rlc::has_bearer(uint16_t rnti, uint32_t lcid) +{ + pthread_rwlock_rdlock(&rwlock); + bool result = false; + if (users.count(rnti)) { + result = users[rnti].rlc->has_bearer(lcid); + } + pthread_rwlock_unlock(&rwlock); + return result; +} + void rlc::read_pdu_pcch(uint8_t* payload, uint32_t buffer_size) { rrc->read_pdu_pcch(payload, buffer_size);