From 7aa5f731ced5e3412b4cc7fedba4f0c4bb4e0f24 Mon Sep 17 00:00:00 2001 From: Francisco Date: Tue, 19 Oct 2021 21:12:21 +0100 Subject: [PATCH] lte,enb,rlc: push to scheduler pending prioritized bytes both in case of RLC timer expiry or in case of new buffer state detection --- lib/include/srsran/rlc/rlc.h | 1 + lib/include/srsran/rlc/rlc_am_lte.h | 1 + lib/include/srsran/rlc/rlc_common.h | 7 ++++--- lib/include/srsran/rlc/rlc_tm.h | 1 + lib/include/srsran/rlc/rlc_um_base.h | 1 + lib/src/rlc/rlc.cc | 22 +++++++++++++--------- lib/src/rlc/rlc_am_lte.cc | 5 +++++ lib/src/rlc/rlc_tm.cc | 6 ++++++ lib/src/rlc/rlc_um_base.cc | 6 ++++++ srsenb/src/stack/upper/rlc.cc | 6 +++--- 10 files changed, 41 insertions(+), 15 deletions(-) diff --git a/lib/include/srsran/rlc/rlc.h b/lib/include/srsran/rlc/rlc.h index ef62f3bbe..bd48b9051 100644 --- a/lib/include/srsran/rlc/rlc.h +++ b/lib/include/srsran/rlc/rlc.h @@ -59,6 +59,7 @@ public: // MAC interface bool has_data_locked(const uint32_t lcid); uint32_t get_buffer_state(const uint32_t lcid); + void get_buffer_state(uint32_t lcid, uint32_t& tx_queue, uint32_t& prio_tx_queue); uint32_t get_total_mch_buffer_state(uint32_t lcid); uint32_t read_pdu(uint32_t lcid, uint8_t* payload, uint32_t nof_bytes); uint32_t read_pdu_mch(uint32_t lcid, uint8_t* payload, uint32_t nof_bytes); diff --git a/lib/include/srsran/rlc/rlc_am_lte.h b/lib/include/srsran/rlc/rlc_am_lte.h index f032cd6b3..0c3f53c18 100644 --- a/lib/include/srsran/rlc/rlc_am_lte.h +++ b/lib/include/srsran/rlc/rlc_am_lte.h @@ -346,6 +346,7 @@ public: // MAC interface bool has_data(); uint32_t get_buffer_state(); + void get_buffer_state(uint32_t& tx_queue, uint32_t& prio_tx_queue); uint32_t read_pdu(uint8_t* payload, uint32_t nof_bytes); void write_pdu(uint8_t* payload, uint32_t nof_bytes); diff --git a/lib/include/srsran/rlc/rlc_common.h b/lib/include/srsran/rlc/rlc_common.h index a9b3b3b4a..c15c915ae 100644 --- a/lib/include/srsran/rlc/rlc_common.h +++ b/lib/include/srsran/rlc/rlc_common.h @@ -272,9 +272,10 @@ public: // MAC interface virtual bool has_data() = 0; bool is_suspended() { return suspended; }; - virtual uint32_t get_buffer_state() = 0; - virtual uint32_t read_pdu(uint8_t* payload, uint32_t nof_bytes) = 0; - virtual void write_pdu(uint8_t* payload, uint32_t nof_bytes) = 0; + virtual uint32_t get_buffer_state() = 0; + virtual void get_buffer_state(uint32_t& tx_queue, uint32_t& prio_tx_queue) = 0; + virtual uint32_t read_pdu(uint8_t* payload, uint32_t nof_bytes) = 0; + virtual void write_pdu(uint8_t* payload, uint32_t nof_bytes) = 0; virtual void set_bsr_callback(bsr_callback_t callback) = 0; diff --git a/lib/include/srsran/rlc/rlc_tm.h b/lib/include/srsran/rlc/rlc_tm.h index f6ecd8947..26c77b926 100644 --- a/lib/include/srsran/rlc/rlc_tm.h +++ b/lib/include/srsran/rlc/rlc_tm.h @@ -54,6 +54,7 @@ public: // MAC interface bool has_data() override; uint32_t get_buffer_state() override; + void get_buffer_state(uint32_t& newtx_queue, uint32_t& prio_tx_queue) override; uint32_t read_pdu(uint8_t* payload, uint32_t nof_bytes) override; void write_pdu(uint8_t* payload, uint32_t nof_bytes) override; diff --git a/lib/include/srsran/rlc/rlc_um_base.h b/lib/include/srsran/rlc/rlc_um_base.h index 997857a8e..cfdbaf0ab 100644 --- a/lib/include/srsran/rlc/rlc_um_base.h +++ b/lib/include/srsran/rlc/rlc_um_base.h @@ -58,6 +58,7 @@ public: // MAC interface bool has_data(); uint32_t get_buffer_state(); + void get_buffer_state(uint32_t& newtx_queue, uint32_t& prio_tx_queue); uint32_t read_pdu(uint8_t* payload, uint32_t nof_bytes); void write_pdu(uint8_t* payload, uint32_t nof_bytes); int get_increment_sequence_num(); diff --git a/lib/src/rlc/rlc.cc b/lib/src/rlc/rlc.cc index e46fcc0a6..fc541be60 100644 --- a/lib/src/rlc/rlc.cc +++ b/lib/src/rlc/rlc.cc @@ -239,20 +239,24 @@ bool rlc::has_data_locked(const uint32_t lcid) return has_data(lcid); } -uint32_t rlc::get_buffer_state(uint32_t lcid) +void rlc::get_buffer_state(uint32_t lcid, uint32_t& tx_queue, uint32_t& prio_tx_queue) { - uint32_t ret = 0; - rwlock_read_guard lock(rwlock); if (valid_lcid(lcid)) { if (rlc_array.at(lcid)->is_suspended()) { - ret = 0; + tx_queue = 0; + prio_tx_queue = 0; } else { - ret = rlc_array.at(lcid)->get_buffer_state(); + rlc_array.at(lcid)->get_buffer_state(tx_queue, prio_tx_queue); } } +} - return ret; +uint32_t rlc::get_buffer_state(uint32_t lcid) +{ + uint32_t tx_queue, prio_tx_queue; + get_buffer_state(lcid, tx_queue, prio_tx_queue); + return tx_queue + prio_tx_queue; } uint32_t rlc::get_total_mch_buffer_state(uint32_t lcid) @@ -592,9 +596,9 @@ bool rlc::valid_lcid_mrb(uint32_t lcid) void rlc::update_bsr(uint32_t lcid) { if (bsr_callback) { - uint32_t tx_queue = get_buffer_state(lcid); - uint32_t retx_queue = 0; // todo: separate tx_queue and retx_queue - bsr_callback(lcid, tx_queue, retx_queue); + uint32_t tx_queue = 0, prio_tx_queue = 0; + get_buffer_state(lcid, tx_queue, prio_tx_queue); + bsr_callback(lcid, tx_queue, prio_tx_queue); } } diff --git a/lib/src/rlc/rlc_am_lte.cc b/lib/src/rlc/rlc_am_lte.cc index 133b5ff1a..d12850a23 100644 --- a/lib/src/rlc/rlc_am_lte.cc +++ b/lib/src/rlc/rlc_am_lte.cc @@ -258,6 +258,11 @@ uint32_t rlc_am_lte::get_buffer_state() return tx.get_buffer_state(); } +void rlc_am_lte::get_buffer_state(uint32_t& tx_queue, uint32_t& prio_tx_queue) +{ + tx.get_buffer_state(tx_queue, prio_tx_queue); +} + uint32_t rlc_am_lte::read_pdu(uint8_t* payload, uint32_t nof_bytes) { uint32_t read_bytes = tx.read_pdu(payload, nof_bytes); diff --git a/lib/src/rlc/rlc_tm.cc b/lib/src/rlc/rlc_tm.cc index 8a6c0376b..ce7cf4d40 100644 --- a/lib/src/rlc/rlc_tm.cc +++ b/lib/src/rlc/rlc_tm.cc @@ -124,6 +124,12 @@ uint32_t rlc_tm::get_buffer_state() return ul_queue.size_bytes(); } +void rlc_tm::get_buffer_state(uint32_t& newtx_queue, uint32_t& prio_tx_queue) +{ + newtx_queue = get_buffer_state(); + prio_tx_queue = 0; +} + rlc_bearer_metrics_t rlc_tm::get_metrics() { std::lock_guard lock(metrics_mutex); diff --git a/lib/src/rlc/rlc_um_base.cc b/lib/src/rlc/rlc_um_base.cc index 2be81a2c7..e0d614621 100644 --- a/lib/src/rlc/rlc_um_base.cc +++ b/lib/src/rlc/rlc_um_base.cc @@ -134,6 +134,12 @@ uint32_t rlc_um_base::get_buffer_state() return 0; } +void rlc_um_base::get_buffer_state(uint32_t& newtx_queue, uint32_t& prio_tx_queue) +{ + newtx_queue = get_buffer_state(); + prio_tx_queue = 0; +} + uint32_t rlc_um_base::read_pdu(uint8_t* payload, uint32_t nof_bytes) { if (tx && tx_enabled) { diff --git a/srsenb/src/stack/upper/rlc.cc b/srsenb/src/stack/upper/rlc.cc index bfb2130f1..25d3c1678 100644 --- a/srsenb/src/stack/upper/rlc.cc +++ b/srsenb/src/stack/upper/rlc.cc @@ -173,10 +173,10 @@ void rlc::reestablish(uint16_t rnti) // In the eNodeB, there is no polling for buffer state from the scheduler. // This function is called by UE RLC instance every time the tx/retx buffers are updated -void rlc::update_bsr(uint32_t rnti, uint32_t lcid, uint32_t tx_queue, uint32_t retx_queue) +void rlc::update_bsr(uint32_t rnti, uint32_t lcid, uint32_t tx_queue, uint32_t prio_tx_queue) { - logger.debug("Buffer state: rnti=0x%x, lcid=%d, tx_queue=%d", rnti, lcid, tx_queue); - mac->rlc_buffer_state(rnti, lcid, tx_queue, retx_queue); + logger.debug("Buffer state: rnti=0x%x, lcid=%d, tx_queue=%d, prio_tx_queue=%d", rnti, lcid, tx_queue, prio_tx_queue); + mac->rlc_buffer_state(rnti, lcid, tx_queue, prio_tx_queue); } int rlc::read_pdu(uint16_t rnti, uint32_t lcid, uint8_t* payload, uint32_t nof_bytes)