diff --git a/lib/include/srslte/upper/rlc_am_lte.h b/lib/include/srslte/upper/rlc_am_lte.h index a35b41db0..3e73e9d22 100644 --- a/lib/include/srslte/upper/rlc_am_lte.h +++ b/lib/include/srslte/upper/rlc_am_lte.h @@ -107,7 +107,7 @@ private: void reestablish(); void stop(); - void write_sdu(unique_byte_buffer_t sdu, bool blocking); + int write_sdu(unique_byte_buffer_t sdu, bool blocking); int read_pdu(uint8_t* payload, uint32_t nof_bytes); void discard_sdu(uint32_t discard_sn); diff --git a/lib/src/upper/rlc_am_lte.cc b/lib/src/upper/rlc_am_lte.cc index 0cfe13917..bb3cfd9f6 100644 --- a/lib/src/upper/rlc_am_lte.cc +++ b/lib/src/upper/rlc_am_lte.cc @@ -129,7 +129,9 @@ void rlc_am_lte::reset_metrics() void rlc_am_lte::write_sdu(unique_byte_buffer_t sdu, bool blocking) { - tx.write_sdu(std::move(sdu), blocking); + if (tx.write_sdu(std::move(sdu), blocking) == SRSLTE_SUCCESS) { + metrics.num_tx_sdus++; + } } void rlc_am_lte::discard_sdu(uint32_t discard_sn) @@ -345,15 +347,15 @@ uint32_t rlc_am_lte::rlc_am_lte_tx::get_buffer_state() return n_bytes; } -void rlc_am_lte::rlc_am_lte_tx::write_sdu(unique_byte_buffer_t sdu, bool blocking) +int rlc_am_lte::rlc_am_lte_tx::write_sdu(unique_byte_buffer_t sdu, bool blocking) { if (!tx_enabled) { - return; + return SRSLTE_ERROR; } if (sdu.get() == nullptr) { log->warning("NULL SDU pointer in write_sdu()\n"); - return; + return SRSLTE_ERROR; } if (blocking) { @@ -378,7 +380,9 @@ void rlc_am_lte::rlc_am_lte_tx::write_sdu(unique_byte_buffer_t sdu, bool blockin ret.error()->N_bytes, tx_sdu_queue.size()); } + return SRSLTE_ERROR; } + return SRSLTE_SUCCESS; } void rlc_am_lte::rlc_am_lte_tx::discard_sdu(uint32_t discard_sn)