Timer removes itself from the map upon expiration

master
Pedro Alvarez 5 years ago committed by Andre Puschmann
parent 47a918d680
commit 61958af70b

@ -53,9 +53,6 @@ public:
// RRC interface
void write_sdu(unique_byte_buffer_t sdu, bool blocking);
uint32_t get_dl_count();
uint32_t get_ul_count();
// RLC interface
void write_pdu(unique_byte_buffer_t pdu);
@ -65,6 +62,9 @@ public:
void set_rx_deliv(uint32_t rx_deliv_) { rx_deliv = rx_deliv_; }
void set_rx_reord(uint32_t rx_reord_) { rx_reord = rx_reord_; }
// State variable getters (useful for testing)
uint32_t nof_discard_timers() { return discard_timers_map.size(); }
private:
bool initialized = false;

@ -373,6 +373,10 @@ void pdcp_entity_nr::discard_callback::operator()(uint32_t timer_id)
// Notify the RLC of the discard. It's the RLC to actually discard, if no segment was transmitted yet.
parent->rlc->discard_sdu(parent->lcid, discard_sn);
// Remove timer from map
// NOTE: this will delete the callback. It *must* be the last instruction.
parent->discard_timers_map.erase(discard_sn);
return;
}

@ -144,7 +144,7 @@ public:
{
log->info("Notifing RLC to discard SDU (SN=%" PRIu32 ")\n", discard_sn);
discard_count++;
log->info("Discard_count=%" PRIu64 ")\n", discard_count);
log->info("Discard_count=%" PRIu64 "\n", discard_count);
}
uint64_t rx_count = 0;

@ -54,12 +54,27 @@ int test_tx_sdu_discard(const pdcp_initial_state& init_state,
timers->step_all();
}
TESTASSERT(rlc->discard_count == 0);
// Check if timers were started
if (imediate_notify) {
TESTASSERT(pdcp->nof_discard_timers() == 0); // RLC notified PDCP already, timer should have been disarmed
} else {
TESTASSERT(pdcp->nof_discard_timers() == 1); // One timer should be running
}
// Last timer step
timers->step_all();
// Check if RLC was notified of SDU discard
if (imediate_notify) {
TESTASSERT(rlc->discard_count == 0); // RLC imediatly notified the PDCP of tx, there should be no timeouts
} else {
TESTASSERT(rlc->discard_count == 1); // RLC does not notify the the PDCP of tx, there should be a timeout
}
// Make sure there are no timers still left on the map
TESTASSERT(pdcp->nof_discard_timers() == 0);
return 0;
}
@ -75,6 +90,12 @@ int test_tx_discard_all(srslte::byte_buffer_pool* pool, srslte::log* log)
* Test TX PDU discard.
*/
TESTASSERT(test_tx_sdu_discard(normal_init_state, srslte::pdcp_discard_timer_t::ms50, false, pool, log) == 0);
/*
* TX Test 2: PDCP Entity with SN LEN = 12
* Test TX PDU discard.
*/
//TESTASSERT(test_tx_sdu_discard(normal_init_state, srslte::pdcp_discard_timer_t::ms50, true, pool, log) == 0);
return 0;
}

Loading…
Cancel
Save