Starting to stop tx'ing packets if TX_NEXT overflows.

This commit is contained in:
Pedro Alvarez 2019-10-10 15:46:23 +01:00 committed by Andre Puschmann
parent 62230c6ab9
commit 2752e3cff5
2 changed files with 11 additions and 4 deletions

View File

@ -82,6 +82,15 @@ void pdcp_entity_nr::write_sdu(unique_byte_buffer_t sdu, bool blocking)
(do_integrity) ? "true" : "false",
(do_encryption) ? "true" : "false");
// Check for COUNT overflow
if (tx_overflow) {
log->warning("TX_NEXT has overflowed. Droping packet\n");
return;
}
if (tx_next + 1 == 0) {
tx_overflow = true;
}
// Start discard timer TODO
// Perform header compression TODO
@ -100,10 +109,6 @@ void pdcp_entity_nr::write_sdu(unique_byte_buffer_t sdu, bool blocking)
// Increment TX_NEXT
tx_next++;
if (tx_next == 0 or tx_overflow) {
tx_overflowasdfdsaf = true;
log->warning("TX_NEXT has overflowed. Droping packet\n");
}
// Check if PDCP is associated with more than on RLC entity TODO
// Write to lower layers

View File

@ -92,6 +92,7 @@ int test_tx(uint32_t n_packets,
srslte::pdcp_entity_nr* pdcp = &pdcp_hlp.pdcp;
rlc_dummy* rlc = &pdcp_hlp.rlc;
pdcp_hlp.set_pdcp_initial_state(init_state);
// Run test
for (uint32_t i = 0; i < n_packets; ++i) {
@ -104,6 +105,7 @@ int test_tx(uint32_t n_packets,
srslte::unique_byte_buffer_t pdu_act = allocate_unique_buffer(*pool);
rlc->get_last_sdu(pdu_act);
std::cout << "Actual RX pdus" << rlc->rx_count << "Rcvd pdus " << n_pdus_exp << "\n";
TESTASSERT(rlc->rx_count == n_pdus_exp);
TESTASSERT(compare_two_packets(pdu_act, pdu_exp) == 0);
return 0;