From fddcbc9879cac9429c64129c3eb8402db59d37f5 Mon Sep 17 00:00:00 2001 From: Francisco Paisana Date: Fri, 19 Jun 2020 17:45:01 +0100 Subject: [PATCH] fix vnf-ue stack interface --- lib/src/upper/rlc_um_base.cc | 6 ++++-- srsue/hdr/stack/ue_stack_nr.h | 6 +++--- srsue/src/stack/mac/mac_nr.cc | 4 +++- srsue/src/stack/ue_stack_nr.cc | 14 +------------- 4 files changed, 11 insertions(+), 19 deletions(-) diff --git a/lib/src/upper/rlc_um_base.cc b/lib/src/upper/rlc_um_base.cc index 5f7748ace..f76097722 100644 --- a/lib/src/upper/rlc_um_base.cc +++ b/lib/src/upper/rlc_um_base.cc @@ -139,8 +139,10 @@ int rlc_um_base::read_pdu(uint8_t* payload, uint32_t nof_bytes) { if (tx && tx_enabled) { uint32_t len = tx->build_data_pdu(payload, nof_bytes); - metrics.num_tx_bytes += len; - metrics.num_tx_pdus++; + if (len > 0) { + metrics.num_tx_bytes += len; + metrics.num_tx_pdus++; + } return len; } return 0; diff --git a/srsue/hdr/stack/ue_stack_nr.h b/srsue/hdr/stack/ue_stack_nr.h index 1c9ef387e..3c791e0db 100644 --- a/srsue/hdr/stack/ue_stack_nr.h +++ b/srsue/hdr/stack/ue_stack_nr.h @@ -81,11 +81,11 @@ public: // MAC interface for PHY int sf_indication(const uint32_t tti) { - mac->sf_indication(tti); + run_tti(tti); return SRSLTE_SUCCESS; } - void tb_decoded(const uint32_t cc_idx, mac_nr_grant_dl_t& grant) final; - void new_grant_ul(const uint32_t cc_idx, const mac_nr_grant_ul_t& grant) final; + void tb_decoded(const uint32_t cc_idx, mac_nr_grant_dl_t& grant) final { mac->tb_decoded(cc_idx, grant); } + void new_grant_ul(const uint32_t cc_idx, const mac_nr_grant_ul_t& grant) final { mac->new_grant_ul(cc_idx, grant); } // Interface for GW void write_sdu(uint32_t lcid, srslte::unique_byte_buffer_t sdu, bool blocking) final; diff --git a/srsue/src/stack/mac/mac_nr.cc b/srsue/src/stack/mac/mac_nr.cc index 56ff8b321..df248b6cd 100644 --- a/srsue/src/stack/mac/mac_nr.cc +++ b/srsue/src/stack/mac/mac_nr.cc @@ -145,7 +145,7 @@ void mac_nr::tb_decoded(const uint32_t cc_idx, mac_nr_grant_dl_t& grant) } } - process_pdus(); + stack->defer_task([this]() { process_pdus(); }); } } @@ -185,6 +185,8 @@ void mac_nr::get_ul_data(const mac_nr_grant_ul_t& grant, phy_interface_stack_nr: if (tx_pdu.add_sdu(args.drb_lcid, rlc_buffer->msg, rlc_buffer->N_bytes) != SRSLTE_SUCCESS) { log_h->error("Error packing MAC PDU\n"); } + } else { + break; } } diff --git a/srsue/src/stack/ue_stack_nr.cc b/srsue/src/stack/ue_stack_nr.cc index b77370a1b..9efab2111 100644 --- a/srsue/src/stack/ue_stack_nr.cc +++ b/srsue/src/stack/ue_stack_nr.cc @@ -214,7 +214,7 @@ void ue_stack_nr::out_of_sync() void ue_stack_nr::run_tti(uint32_t tti) { - // pending_tasks.push(sync_queue_id, task_t{[this, tti](task_t*) { run_tti_impl(tti); }}); + pending_tasks.push(sync_queue_id, [this, tti]() { run_tti_impl(tti); }); } void ue_stack_nr::run_tti_impl(uint32_t tti) @@ -238,18 +238,6 @@ void ue_stack_nr::start_cell_select(const phy_interface_rrc_lte::phy_cell_t* cel // not implemented } -void ue_stack_nr::tb_decoded(const uint32_t cc_idx, mac_nr_grant_dl_t& grant) -{ - pending_tasks.push( - mac_queue_id, - std::bind([this, cc_idx](mac_nr_grant_dl_t& grant) { mac->tb_decoded(cc_idx, grant); }, std::move(grant))); -} - -void ue_stack_nr::new_grant_ul(const uint32_t cc_idx, const mac_nr_grant_ul_t& grant) -{ - pending_tasks.push(mac_queue_id, [this, cc_idx, grant]() { mac->new_grant_ul(cc_idx, grant); }); -} - /*************************** * Task Handling Interface **************************/