From 023cb0fddee61c813a0159e1e40e3b3d98d08020 Mon Sep 17 00:00:00 2001 From: Francisco Date: Mon, 1 Mar 2021 11:22:08 +0000 Subject: [PATCH] log on allocation failure in mac::ue class --- srsenb/hdr/stack/mac/ue.h | 17 ++++++----------- srsenb/src/stack/mac/ue.cc | 4 ++++ 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/srsenb/hdr/stack/mac/ue.h b/srsenb/hdr/stack/mac/ue.h index ba2cd1824..47bc8f679 100644 --- a/srsenb/hdr/stack/mac/ue.h +++ b/srsenb/hdr/stack/mac/ue.h @@ -47,7 +47,7 @@ public: void allocate_cc(uint32_t nof_prb, uint32_t nof_rx_harq_proc, uint32_t nof_tx_harq_proc); void deallocate_cc(); - bool empty() const { return softbuffer_tx_list.empty(); } + bool empty() const { return softbuffer_tx_list.empty() and softbuffer_rx_list.empty(); } srslte_softbuffer_tx_t& get_tx_softbuffer(uint32_t pid, uint32_t tb_idx) { return softbuffer_tx_list.at(pid * SRSLTE_MAX_TB + tb_idx); @@ -88,22 +88,17 @@ public: uint32_t nof_cells_, uint32_t nof_rx_harq_proc = SRSLTE_FDD_NOF_HARQ, uint32_t nof_tx_harq_proc = SRSLTE_FDD_NOF_HARQ); - virtual ~ue(); - - void reset(); - - void start_pcap(srslte::mac_pcap* pcap_); - void set_tti(uint32_t tti); + virtual ~ue(); + void reset(); + void start_pcap(srslte::mac_pcap* pcap_); + void set_tti(uint32_t tti); uint16_t get_rnti() { return rnti; } - uint32_t set_ta(int ta) override; - void start_ta() { ta_fsm.start(); }; uint32_t set_ta_us(float ta_us) { return ta_fsm.push_value(ta_us); }; - - void tic(); + void tic(); uint8_t* generate_pdu(uint32_t ue_cc_idx, uint32_t harq_pid, diff --git a/srsenb/src/stack/mac/ue.cc b/srsenb/src/stack/mac/ue.cc index 0db8e45c6..ae44c0ee4 100644 --- a/srsenb/src/stack/mac/ue.cc +++ b/srsenb/src/stack/mac/ue.cc @@ -27,6 +27,10 @@ cc_buffer_handler::cc_buffer_handler() for (auto& harq_buffers : tx_payload_buffer) { for (srslte::unique_byte_buffer_t& tb_buffer : harq_buffers) { tb_buffer = srslte::make_byte_buffer(); + if (tb_buffer == nullptr) { + srslog::fetch_basic_logger("MAC").error("Failed to allocate HARQ buffers for UE"); + return; + } } } }