rlc_am_lte: avoid locking of Rx mutex twice when generating status PDU

call reset_status(), which now is an private method directly when
building a status PDU. No need for the Tx side to call Rx again.
This commit is contained in:
Andre Puschmann 2021-07-05 16:32:52 +02:00
parent 53a7dc78ee
commit 4379c20eb9
2 changed files with 4 additions and 5 deletions

View File

@ -484,7 +484,6 @@ private:
int get_status_pdu_length();
int get_status_pdu(rlc_status_pdu_t* status, const uint32_t nof_bytes);
bool get_do_status();
void reset_status(); // called when status PDU has been sent
private:
void handle_data_pdu(uint8_t* payload, uint32_t nof_bytes, rlc_amd_pdu_header_t& header);
@ -494,6 +493,7 @@ private:
void debug_state();
void print_rx_segments();
bool add_segment_and_check(rlc_amd_rx_pdu_segments_t* pdu, rlc_amd_rx_pdu* segment);
void reset_status();
rlc_am_lte* parent = nullptr;
byte_buffer_pool* pool = nullptr;

View File

@ -671,9 +671,6 @@ int rlc_am_lte::rlc_am_lte_tx::build_status_pdu(uint8_t* payload, uint32_t nof_b
pdu_len = 0;
} else if (pdu_len > 0 && nof_bytes >= static_cast<uint32_t>(pdu_len)) {
log_rlc_am_status_pdu_to_string(logger.info, "%s Tx status PDU - %s", &tx_status, RB_NAME);
parent->rx.reset_status();
if (cfg.t_status_prohibit > 0 && status_prohibit_timer.is_valid()) {
// re-arm timer
status_prohibit_timer.run();
@ -1845,7 +1842,6 @@ void rlc_am_lte::rlc_am_lte_rx::reassemble_rx_sdus()
void rlc_am_lte::rlc_am_lte_rx::reset_status()
{
std::lock_guard<std::mutex> lock(mutex);
do_status = false;
poll_received = false;
}
@ -1970,6 +1966,9 @@ int rlc_am_lte::rlc_am_lte_rx::get_status_pdu(rlc_status_pdu_t* status, const ui
i = (i + 1) % MOD;
}
// valid PDU could be generated
reset_status();
return rlc_am_packed_length(status);
}