rlc_am: change return value when writing SDU

return false when SDU couldn't be added to SDU tx queue so
to count dropped SDUs in base
master
Andre Puschmann 5 years ago
parent 3cef20607e
commit 82f811ed52

@ -107,7 +107,7 @@ private:
void reestablish(); void reestablish();
void stop(); 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); int read_pdu(uint8_t* payload, uint32_t nof_bytes);
void discard_sdu(uint32_t discard_sn); void discard_sdu(uint32_t discard_sn);

@ -129,7 +129,9 @@ void rlc_am_lte::reset_metrics()
void rlc_am_lte::write_sdu(unique_byte_buffer_t sdu, bool blocking) 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) 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; 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) { if (!tx_enabled) {
return; return SRSLTE_ERROR;
} }
if (sdu.get() == nullptr) { if (sdu.get() == nullptr) {
log->warning("NULL SDU pointer in write_sdu()\n"); log->warning("NULL SDU pointer in write_sdu()\n");
return; return SRSLTE_ERROR;
} }
if (blocking) { 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, ret.error()->N_bytes,
tx_sdu_queue.size()); tx_sdu_queue.size());
} }
return SRSLTE_ERROR;
} }
return SRSLTE_SUCCESS;
} }
void rlc_am_lte::rlc_am_lte_tx::discard_sdu(uint32_t discard_sn) void rlc_am_lte::rlc_am_lte_tx::discard_sdu(uint32_t discard_sn)

Loading…
Cancel
Save