lib,rlc_am_nr: fix access of unconfigured entity

master
Robert Falkenberg 3 years ago
parent 47c1845cdc
commit 717132e0c3

@ -854,6 +854,11 @@ void rlc_am_nr_tx::get_buffer_state(uint32_t& n_bytes_new, uint32_t& n_bytes_pri
std::lock_guard<std::mutex> lock(mutex);
RlcDebug("buffer state - do_status=%s", do_status() ? "yes" : "no");
if (!tx_enabled) {
RlcError("get_buffer_state() failed: TX is not enabled.");
return;
}
// Bytes needed for status report
if (do_status()) {
n_bytes_prio += rx->get_status_pdu_length();

@ -225,9 +225,6 @@ int basic_test(rlc_am_nr_sn_size_t sn_size)
rlc_am_nr_tx* tx2 = dynamic_cast<rlc_am_nr_tx*>(rlc2.get_tx());
rlc_am_nr_rx* rx2 = dynamic_cast<rlc_am_nr_rx*>(rlc2.get_rx());
// before configuring entity
TESTASSERT_EQ(0, rlc1.get_buffer_state());
if (not rlc1.configure(rlc_config_t::default_rlc_am_nr_config(to_number(sn_size)))) {
return -1;
}
@ -236,6 +233,9 @@ int basic_test(rlc_am_nr_sn_size_t sn_size)
return -1;
}
// after configuring entity
TESTASSERT_EQ(0, rlc1.get_buffer_state());
basic_test_tx(&rlc1, pdu_bufs, sn_size);
// Write 5 PDUs into RLC2
@ -332,9 +332,6 @@ int lost_pdu_test(rlc_am_nr_sn_size_t sn_size)
uint32_t data_pdu_size = header_size + payload_size;
uint32_t expect_buffer_state = NBUFS * data_pdu_size;
// before configuring entity
TESTASSERT(0 == rlc1.get_buffer_state());
if (not rlc1.configure(rlc_config_t::default_rlc_am_nr_config(to_number(sn_size)))) {
return -1;
}
@ -343,6 +340,9 @@ int lost_pdu_test(rlc_am_nr_sn_size_t sn_size)
return -1;
}
// after configuring entity
TESTASSERT(0 == rlc1.get_buffer_state());
basic_test_tx(&rlc1, pdu_bufs, sn_size);
// Write 5 PDUs into RLC2
@ -469,9 +469,6 @@ int basic_segmentation_test(rlc_am_nr_sn_size_t sn_size)
rlc_am_nr_tx* tx2 = dynamic_cast<rlc_am_nr_tx*>(rlc2.get_tx());
rlc_am_nr_rx* rx2 = dynamic_cast<rlc_am_nr_rx*>(rlc2.get_rx());
// before configuring entity
TESTASSERT_EQ(0, rlc1.get_buffer_state());
if (not rlc1.configure(rlc_config_t::default_rlc_am_nr_config(to_number(sn_size)))) {
return -1;
}
@ -480,6 +477,9 @@ int basic_segmentation_test(rlc_am_nr_sn_size_t sn_size)
return -1;
}
// after configuring entity
TESTASSERT_EQ(0, rlc1.get_buffer_state());
// Push 1 SDU into RLC1
unique_byte_buffer_t sdu;
constexpr uint32_t payload_size = 3; // Give the SDU the size of 3 bytes
@ -557,9 +557,6 @@ int segment_retx_test()
rlc_am_nr_tx* tx2 = dynamic_cast<rlc_am_nr_tx*>(rlc2.get_tx());
rlc_am_nr_rx* rx2 = dynamic_cast<rlc_am_nr_rx*>(rlc2.get_rx());
// before configuring entity
TESTASSERT_EQ(0, rlc1.get_buffer_state());
if (not rlc1.configure(rlc_config_t::default_rlc_am_nr_config())) {
return -1;
}
@ -568,6 +565,9 @@ int segment_retx_test()
return -1;
}
// after configuring entity
TESTASSERT_EQ(0, rlc1.get_buffer_state());
// Push 5 SDUs into RLC1
unique_byte_buffer_t sdu_bufs[NBUFS];
for (int i = 0; i < NBUFS; i++) {
@ -728,9 +728,6 @@ int retx_segment_test()
rlc_am_nr_tx* tx2 = dynamic_cast<rlc_am_nr_tx*>(rlc2.get_tx());
rlc_am_nr_rx* rx2 = dynamic_cast<rlc_am_nr_rx*>(rlc2.get_rx());
// before configuring entity
TESTASSERT(0 == rlc1.get_buffer_state());
if (not rlc1.configure(rlc_config_t::default_rlc_am_nr_config())) {
return -1;
}
@ -739,6 +736,9 @@ int retx_segment_test()
return -1;
}
// after configuring entity
TESTASSERT(0 == rlc1.get_buffer_state());
int n_sdu_bufs = 5;
int n_pdu_bufs = 15;

Loading…
Cancel
Save