|
|
@ -650,20 +650,14 @@ int retx_segment_test()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TESTASSERT(0 == rlc1.get_buffer_state());
|
|
|
|
TESTASSERT(0 == rlc1.get_buffer_state());
|
|
|
|
return SRSRAN_SUCCESS;
|
|
|
|
|
|
|
|
// Write 15 - 3 PDUs into RLC2
|
|
|
|
// Write 15 - 3 PDUs into RLC2
|
|
|
|
for (int i = 0; i < n_pdu_bufs; i++) {
|
|
|
|
for (int i = 0; i < n_pdu_bufs; i++) {
|
|
|
|
if (i != 3) {
|
|
|
|
if (i != 3 && i != 7 && i != 11) {
|
|
|
|
rlc2.write_pdu(pdu_bufs[i]->msg, pdu_bufs[i]->N_bytes); // Lose first segment of RLC_SN=1.
|
|
|
|
rlc2.write_pdu(pdu_bufs[i]->msg, pdu_bufs[i]->N_bytes); // Lose first segment of RLC_SN=1.
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (i != 3) {
|
|
|
|
|
|
|
|
rlc2.write_pdu(pdu_bufs[i]->msg, pdu_bufs[i]->N_bytes); // Lose middle segment of RLC_SN=2.
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (i != 3) {
|
|
|
|
|
|
|
|
rlc2.write_pdu(pdu_bufs[i]->msg, pdu_bufs[i]->N_bytes); // Lose last segment of RLC_SN=3.
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/*
|
|
|
|
|
|
|
|
// Only after t-reassembly has expired, will the status report include NACKs.
|
|
|
|
// Only after t-reassembly has expired, will the status report include NACKs.
|
|
|
|
TESTASSERT(3 == rlc2.get_buffer_state());
|
|
|
|
TESTASSERT(3 == rlc2.get_buffer_state());
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -677,7 +671,7 @@ int retx_segment_test()
|
|
|
|
// Assert status is correct
|
|
|
|
// Assert status is correct
|
|
|
|
rlc_am_nr_status_pdu_t status_check = {};
|
|
|
|
rlc_am_nr_status_pdu_t status_check = {};
|
|
|
|
rlc_am_nr_read_status_pdu(&status_buf, rlc_am_nr_sn_size_t::size12bits, &status_check);
|
|
|
|
rlc_am_nr_read_status_pdu(&status_buf, rlc_am_nr_sn_size_t::size12bits, &status_check);
|
|
|
|
TESTASSERT(status_check.ack_sn == 3); // 3 is the next expected SN (i.e. the lost packet.)
|
|
|
|
TESTASSERT(status_check.ack_sn == 1); // 1 is the next expected SN (i.e. the first lost packet.)
|
|
|
|
|
|
|
|
|
|
|
|
// Write status PDU to RLC1
|
|
|
|
// Write status PDU to RLC1
|
|
|
|
rlc1.write_pdu(status_buf.msg, status_buf.N_bytes);
|
|
|
|
rlc1.write_pdu(status_buf.msg, status_buf.N_bytes);
|
|
|
@ -689,11 +683,12 @@ int retx_segment_test()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// t-reassembly has expired. There should be a NACK in the status report.
|
|
|
|
// t-reassembly has expired. There should be a NACK in the status report.
|
|
|
|
TESTASSERT(5 == rlc2.get_buffer_state());
|
|
|
|
// There should be 3 NACKs with SO_start and SO_end
|
|
|
|
|
|
|
|
TESTASSERT(20 == rlc2.get_buffer_state()); // 2 bytes for ACK + 3 * 6 for NACK with SO = 20.
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Read status PDU from RLC2
|
|
|
|
// Read status PDU from RLC2
|
|
|
|
byte_buffer_t status_buf;
|
|
|
|
byte_buffer_t status_buf;
|
|
|
|
int len = rlc2.read_pdu(status_buf.msg, 5);
|
|
|
|
int len = rlc2.read_pdu(status_buf.msg, 20);
|
|
|
|
status_buf.N_bytes = len;
|
|
|
|
status_buf.N_bytes = len;
|
|
|
|
|
|
|
|
|
|
|
|
TESTASSERT(0 == rlc2.get_buffer_state());
|
|
|
|
TESTASSERT(0 == rlc2.get_buffer_state());
|
|
|
@ -702,7 +697,7 @@ int retx_segment_test()
|
|
|
|
rlc_am_nr_status_pdu_t status_check = {};
|
|
|
|
rlc_am_nr_status_pdu_t status_check = {};
|
|
|
|
rlc_am_nr_read_status_pdu(&status_buf, rlc_am_nr_sn_size_t::size12bits, &status_check);
|
|
|
|
rlc_am_nr_read_status_pdu(&status_buf, rlc_am_nr_sn_size_t::size12bits, &status_check);
|
|
|
|
TESTASSERT(status_check.ack_sn == 5); // 5 is the next expected SN.
|
|
|
|
TESTASSERT(status_check.ack_sn == 5); // 5 is the next expected SN.
|
|
|
|
TESTASSERT(status_check.N_nack == 1); // We lost one PDU.
|
|
|
|
TESTASSERT(status_check.N_nack == 3); // We lost one PDU.
|
|
|
|
TESTASSERT(status_check.nacks[0].nack_sn == 3); // Lost PDU SN=3.
|
|
|
|
TESTASSERT(status_check.nacks[0].nack_sn == 3); // Lost PDU SN=3.
|
|
|
|
|
|
|
|
|
|
|
|
// Write status PDU to RLC1
|
|
|
|
// Write status PDU to RLC1
|
|
|
@ -711,7 +706,7 @@ int retx_segment_test()
|
|
|
|
// Check there is an Retx of SN=3
|
|
|
|
// Check there is an Retx of SN=3
|
|
|
|
TESTASSERT(5 == rlc1.get_buffer_state());
|
|
|
|
TESTASSERT(5 == rlc1.get_buffer_state());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Re-transmit PDU in 3 segments
|
|
|
|
// Re-transmit PDU in 3 segments
|
|
|
|
for (int i = 0; i < 3; i++) {
|
|
|
|
for (int i = 0; i < 3; i++) {
|
|
|
@ -807,11 +802,11 @@ int main()
|
|
|
|
// start log back-end
|
|
|
|
// start log back-end
|
|
|
|
srslog::init();
|
|
|
|
srslog::init();
|
|
|
|
|
|
|
|
|
|
|
|
TESTASSERT(window_checker_test() == SRSRAN_SUCCESS);
|
|
|
|
// TESTASSERT(window_checker_test() == SRSRAN_SUCCESS);
|
|
|
|
TESTASSERT(basic_test() == SRSRAN_SUCCESS);
|
|
|
|
// TESTASSERT(basic_test() == SRSRAN_SUCCESS);
|
|
|
|
TESTASSERT(lost_pdu_test() == SRSRAN_SUCCESS);
|
|
|
|
// TESTASSERT(lost_pdu_test() == SRSRAN_SUCCESS);
|
|
|
|
TESTASSERT(basic_segmentation_test() == SRSRAN_SUCCESS);
|
|
|
|
// TESTASSERT(basic_segmentation_test() == SRSRAN_SUCCESS);
|
|
|
|
TESTASSERT(segment_retx_test() == SRSRAN_SUCCESS);
|
|
|
|
// TESTASSERT(segment_retx_test() == SRSRAN_SUCCESS);
|
|
|
|
TESTASSERT(retx_segment_test() == SRSRAN_SUCCESS);
|
|
|
|
TESTASSERT(retx_segment_test() == SRSRAN_SUCCESS);
|
|
|
|
return SRSRAN_SUCCESS;
|
|
|
|
return SRSRAN_SUCCESS;
|
|
|
|
}
|
|
|
|
}
|
|
|
|