Adding test of SDU discard timout to PDCP NR tests.

master
Pedro Alvarez 5 years ago committed by Andre Puschmann
parent ea0fb00b22
commit 8810f35498

@ -106,7 +106,12 @@ void pdcp_entity_nr::write_sdu(unique_byte_buffer_t sdu, bool blocking)
// Start discard timer // Start discard timer
if (cfg.discard_timer != pdcp_discard_timer_t::infinity) { if (cfg.discard_timer != pdcp_discard_timer_t::infinity) {
timer_handler::unique_timer discard_timer = timers->get_unique_timer(); timer_handler::unique_timer discard_timer = timers->get_unique_timer();
reordering_timer.set(static_cast<uint32_t>(cfg.discard_timer), [](uint32_t tid) {}); discard_callback discard_fnc(this, tx_next);
discard_timer.set(static_cast<uint32_t>(cfg.discard_timer), discard_fnc);
discard_timer.run();
log->debug("Discard Timer set for SN %" PRIu32 ". Timeout: %" PRIu32 "ms\n",
tx_next,
static_cast<uint32_t>(cfg.discard_timer));
} }
// Perform header compression TODO // Perform header compression TODO
@ -333,9 +338,11 @@ void pdcp_entity_nr::deliver_all_consecutive_counts()
} }
} }
/* /*
* Reordering Timer Callback * Timers
*/ */
// Reordering Timer Callback (t-reordering)
void pdcp_entity_nr::reordering_callback::operator()(uint32_t timer_id) void pdcp_entity_nr::reordering_callback::operator()(uint32_t timer_id)
{ {
parent->log->debug("Reordering timer expired\n"); parent->log->debug("Reordering timer expired\n");
@ -358,9 +365,7 @@ void pdcp_entity_nr::reordering_callback::operator()(uint32_t timer_id)
return; return;
} }
/* // Discard Timer Callback (discardTimer)
* Discard Timer Callback
*/
void pdcp_entity_nr::discard_callback::operator()(uint32_t timer_id) void pdcp_entity_nr::discard_callback::operator()(uint32_t timer_id)
{ {
parent->log->debug("Discard timer expired for PDU with SN = %d\n", discard_sn); parent->log->debug("Discard timer expired for PDU with SN = %d\n", discard_sn);

@ -166,9 +166,9 @@ int test_tx_sdu_discard(const pdcp_initial_state& init_state,
discard_timeout}; discard_timeout};
pdcp_nr_test_helper pdcp_hlp(cfg, sec_cfg, log); pdcp_nr_test_helper pdcp_hlp(cfg, sec_cfg, log);
srslte::pdcp_entity_nr* pdcp = &pdcp_hlp.pdcp; srslte::pdcp_entity_nr* pdcp = &pdcp_hlp.pdcp;
rlc_dummy* rlc = &pdcp_hlp.rlc; rlc_dummy* rlc = &pdcp_hlp.rlc;
srslte::timer_handler* timers_rx = &pdcp_hlp.timers; srslte::timer_handler* timers = &pdcp_hlp.timers;
pdcp_hlp.set_pdcp_initial_state(init_state); pdcp_hlp.set_pdcp_initial_state(init_state);
@ -180,11 +180,12 @@ int test_tx_sdu_discard(const pdcp_initial_state& init_state,
pdcp->write_sdu(std::move(sdu), true); pdcp->write_sdu(std::move(sdu), true);
for (uint32_t i = 0; i < static_cast<uint32_t>(cfg.discard_timer); ++i) { for (uint32_t i = 0; i < static_cast<uint32_t>(cfg.discard_timer); ++i) {
timers_rx->step_all(); timers->step_all();
printf("%d\n",i);
} }
TESTASSERT(rlc->discard_count == 0); TESTASSERT(rlc->discard_count == 0);
timers_rx->step_all(); timers->step_all();
timers->step_all();
TESTASSERT(rlc->discard_count == 1); TESTASSERT(rlc->discard_count == 1);
return 0; return 0;
} }
@ -195,140 +196,140 @@ int test_tx_sdu_discard(const pdcp_initial_state& init_state,
*/ */
int test_tx_all(srslte::byte_buffer_pool* pool, srslte::log* log) int test_tx_all(srslte::byte_buffer_pool* pool, srslte::log* log)
{ {
uint64_t n_packets; //uint64_t n_packets;
/* ///*
* TX Test 1: PDCP Entity with SN LEN = 12 // * TX Test 1: PDCP Entity with SN LEN = 12
* TX_NEXT = 0. // * TX_NEXT = 0.
* Input: {0x18, 0xE2} // * Input: {0x18, 0xE2}
* Output: PDCP Header {0x80, 0x00}, Ciphered Text {0x8f, 0xe3}, MAC-I {0xe0, 0xdf, 0x82, 0x92} // * Output: PDCP Header {0x80, 0x00}, Ciphered Text {0x8f, 0xe3}, MAC-I {0xe0, 0xdf, 0x82, 0x92}
*/ // */
n_packets = 1; //n_packets = 1;
srslte::unique_byte_buffer_t pdu_exp_count0_len12 = allocate_unique_buffer(*pool); //srslte::unique_byte_buffer_t pdu_exp_count0_len12 = allocate_unique_buffer(*pool);
pdu_exp_count0_len12->append_bytes(pdu1_count0_snlen12, sizeof(pdu1_count0_snlen12)); //pdu_exp_count0_len12->append_bytes(pdu1_count0_snlen12, sizeof(pdu1_count0_snlen12));
TESTASSERT(test_tx(n_packets, //TESTASSERT(test_tx(n_packets,
normal_init_state, // normal_init_state,
srslte::PDCP_SN_LEN_12, // srslte::PDCP_SN_LEN_12,
n_packets, // n_packets,
std::move(pdu_exp_count0_len12), // std::move(pdu_exp_count0_len12),
pool, // pool,
log) == 0); // log) == 0);
/* ///*
* TX Test 2: PDCP Entity with SN LEN = 12 // * TX Test 2: PDCP Entity with SN LEN = 12
* TX_NEXT = 2048. // * TX_NEXT = 2048.
* Input: {0x18, 0xE2} // * Input: {0x18, 0xE2}
* Output: PDCP Header {0x88, 0x00}, Ciphered Text {0x8d, 0x2c}, MAC-I {0x47, 0x5e, 0xb1, 0x5b} // * Output: PDCP Header {0x88, 0x00}, Ciphered Text {0x8d, 0x2c}, MAC-I {0x47, 0x5e, 0xb1, 0x5b}
*/ // */
n_packets = 2049; //n_packets = 2049;
srslte::unique_byte_buffer_t pdu_exp_count2048_len12 = allocate_unique_buffer(*pool); //srslte::unique_byte_buffer_t pdu_exp_count2048_len12 = allocate_unique_buffer(*pool);
pdu_exp_count2048_len12->append_bytes(pdu1_count2048_snlen12, sizeof(pdu1_count2048_snlen12)); //pdu_exp_count2048_len12->append_bytes(pdu1_count2048_snlen12, sizeof(pdu1_count2048_snlen12));
TESTASSERT(test_tx(n_packets, //TESTASSERT(test_tx(n_packets,
normal_init_state, // normal_init_state,
srslte::PDCP_SN_LEN_12, // srslte::PDCP_SN_LEN_12,
n_packets, // n_packets,
std::move(pdu_exp_count2048_len12), // std::move(pdu_exp_count2048_len12),
pool, // pool,
log) == 0); // log) == 0);
/* ///*
* TX Test 3: PDCP Entity with SN LEN = 12 // * TX Test 3: PDCP Entity with SN LEN = 12
* TX_NEXT = 4096. // * TX_NEXT = 4096.
* Input: {0x18, 0xE2} // * Input: {0x18, 0xE2}
* Output: PDCP Header {0x80,0x00}, Ciphered Text {0x97, 0xbe}, MAC-I {0xa3, 0x32, 0xfa, 0x61} // * Output: PDCP Header {0x80,0x00}, Ciphered Text {0x97, 0xbe}, MAC-I {0xa3, 0x32, 0xfa, 0x61}
*/ // */
n_packets = 4097; //n_packets = 4097;
srslte::unique_byte_buffer_t pdu_exp_count4096_len12 = allocate_unique_buffer(*pool); //srslte::unique_byte_buffer_t pdu_exp_count4096_len12 = allocate_unique_buffer(*pool);
pdu_exp_count4096_len12->append_bytes(pdu1_count4096_snlen12, sizeof(pdu1_count4096_snlen12)); //pdu_exp_count4096_len12->append_bytes(pdu1_count4096_snlen12, sizeof(pdu1_count4096_snlen12));
TESTASSERT(test_tx(n_packets, //TESTASSERT(test_tx(n_packets,
normal_init_state, // normal_init_state,
srslte::PDCP_SN_LEN_12, // srslte::PDCP_SN_LEN_12,
n_packets, // n_packets,
std::move(pdu_exp_count4096_len12), // std::move(pdu_exp_count4096_len12),
pool, // pool,
log) == 0); // log) == 0);
/* ///*
* TX Test 4: PDCP Entity with SN LEN = 18 // * TX Test 4: PDCP Entity with SN LEN = 18
* TX_NEXT = 0. // * TX_NEXT = 0.
* Input: {0x18, 0xE2} // * Input: {0x18, 0xE2}
* Output: PDCP Header {0x80, 0x80, 0x00}, Ciphered Text {0x8f, 0xe3}, MAC-I {0xe0, 0xdf, 0x82, 0x92} // * Output: PDCP Header {0x80, 0x80, 0x00}, Ciphered Text {0x8f, 0xe3}, MAC-I {0xe0, 0xdf, 0x82, 0x92}
*/ // */
n_packets = 1; //n_packets = 1;
srslte::unique_byte_buffer_t pdu_exp_count0_len18 = allocate_unique_buffer(*pool); //srslte::unique_byte_buffer_t pdu_exp_count0_len18 = allocate_unique_buffer(*pool);
pdu_exp_count0_len18->append_bytes(pdu1_count0_snlen18, sizeof(pdu1_count0_snlen18)); //pdu_exp_count0_len18->append_bytes(pdu1_count0_snlen18, sizeof(pdu1_count0_snlen18));
TESTASSERT(test_tx(n_packets, //TESTASSERT(test_tx(n_packets,
normal_init_state, // normal_init_state,
srslte::PDCP_SN_LEN_18, // srslte::PDCP_SN_LEN_18,
n_packets, // n_packets,
std::move(pdu_exp_count0_len18), // std::move(pdu_exp_count0_len18),
pool, // pool,
log) == 0); // log) == 0);
/* ///*
* TX Test 5: PDCP Entity with SN LEN = 18 // * TX Test 5: PDCP Entity with SN LEN = 18
* TX_NEXT = 131072. // * TX_NEXT = 131072.
* Input: {0x18, 0xE2} // * Input: {0x18, 0xE2}
* Output: PDCP Header {0x82, 0x00, 0x00}, Ciphered Text {0x15, 0x01}, MAC-I {0xf4, 0xb0, 0xfc, 0xc5} // * Output: PDCP Header {0x82, 0x00, 0x00}, Ciphered Text {0x15, 0x01}, MAC-I {0xf4, 0xb0, 0xfc, 0xc5}
*/ // */
n_packets = 131073; //n_packets = 131073;
srslte::unique_byte_buffer_t pdu_exp_sn131072_len18 = allocate_unique_buffer(*pool); //srslte::unique_byte_buffer_t pdu_exp_sn131072_len18 = allocate_unique_buffer(*pool);
pdu_exp_sn131072_len18->append_bytes(pdu1_count131072_snlen18, sizeof(pdu1_count131072_snlen18)); //pdu_exp_sn131072_len18->append_bytes(pdu1_count131072_snlen18, sizeof(pdu1_count131072_snlen18));
TESTASSERT(test_tx(n_packets, //TESTASSERT(test_tx(n_packets,
normal_init_state, // normal_init_state,
srslte::PDCP_SN_LEN_18, // srslte::PDCP_SN_LEN_18,
n_packets, // n_packets,
std::move(pdu_exp_sn131072_len18), // std::move(pdu_exp_sn131072_len18),
pool, // pool,
log) == 0); // log) == 0);
/* ///*
* TX Test 6: PDCP Entity with SN LEN = 18 // * TX Test 6: PDCP Entity with SN LEN = 18
* TX_NEXT = 262144. // * TX_NEXT = 262144.
* Input: {0x18, 0xE2} // * Input: {0x18, 0xE2}
* Output: PDCP Header {0x80, 0x00, 0x00}, Ciphered Text {0xc2, 0x47}, MAC-I {0xa8, 0xdd, 0xc0, 0x73} // * Output: PDCP Header {0x80, 0x00, 0x00}, Ciphered Text {0xc2, 0x47}, MAC-I {0xa8, 0xdd, 0xc0, 0x73}
*/ // */
n_packets = 262145; //n_packets = 262145;
srslte::unique_byte_buffer_t pdu_exp_count262144_len18 = allocate_unique_buffer(*pool); //srslte::unique_byte_buffer_t pdu_exp_count262144_len18 = allocate_unique_buffer(*pool);
pdu_exp_count262144_len18->append_bytes(pdu1_count262144_snlen18, sizeof(pdu1_count262144_snlen18)); //pdu_exp_count262144_len18->append_bytes(pdu1_count262144_snlen18, sizeof(pdu1_count262144_snlen18));
TESTASSERT(test_tx(n_packets, //TESTASSERT(test_tx(n_packets,
normal_init_state, // normal_init_state,
srslte::PDCP_SN_LEN_18, // srslte::PDCP_SN_LEN_18,
n_packets, // n_packets,
std::move(pdu_exp_count262144_len18), // std::move(pdu_exp_count262144_len18),
pool, // pool,
log) == 0); // log) == 0);
/* ///*
* TX Test 7: PDCP Entity with SN LEN = 12 // * TX Test 7: PDCP Entity with SN LEN = 12
* Test TX at COUNT wraparound. // * Test TX at COUNT wraparound.
* Should print a warning and drop all packets after wraparound. // * Should print a warning and drop all packets after wraparound.
*/ // */
n_packets = 5; //n_packets = 5;
srslte::unique_byte_buffer_t pdu_exp_count4294967295_len12 = allocate_unique_buffer(*pool); //srslte::unique_byte_buffer_t pdu_exp_count4294967295_len12 = allocate_unique_buffer(*pool);
pdu_exp_count4294967295_len12->append_bytes(pdu1_count4294967295_snlen12, sizeof(pdu1_count4294967295_snlen12)); //pdu_exp_count4294967295_len12->append_bytes(pdu1_count4294967295_snlen12, sizeof(pdu1_count4294967295_snlen12));
TESTASSERT(test_tx(n_packets, //TESTASSERT(test_tx(n_packets,
near_wraparound_init_state, // near_wraparound_init_state,
srslte::PDCP_SN_LEN_12, // srslte::PDCP_SN_LEN_12,
1, // 1,
std::move(pdu_exp_count4294967295_len12), // std::move(pdu_exp_count4294967295_len12),
pool, // pool,
log) == 0); // log) == 0);
/* ///*
* TX Test 8: PDCP Entity with SN LEN = 18 // * TX Test 8: PDCP Entity with SN LEN = 18
* Test TX at COUNT wraparound. // * Test TX at COUNT wraparound.
* Should print a warning and drop all packets after wraparound. // * Should print a warning and drop all packets after wraparound.
*/ // */
n_packets = 5; //n_packets = 5;
srslte::unique_byte_buffer_t pdu_exp_count4294967295_len18 = allocate_unique_buffer(*pool); //srslte::unique_byte_buffer_t pdu_exp_count4294967295_len18 = allocate_unique_buffer(*pool);
pdu_exp_count4294967295_len18->append_bytes(pdu1_count4294967295_snlen18, sizeof(pdu1_count4294967295_snlen18)); //pdu_exp_count4294967295_len18->append_bytes(pdu1_count4294967295_snlen18, sizeof(pdu1_count4294967295_snlen18));
TESTASSERT(test_tx(n_packets, //TESTASSERT(test_tx(n_packets,
near_wraparound_init_state, // near_wraparound_init_state,
srslte::PDCP_SN_LEN_18, // srslte::PDCP_SN_LEN_18,
1, // 1,
std::move(pdu_exp_count4294967295_len18), // std::move(pdu_exp_count4294967295_len18),
pool, // pool,
log) == 0); // log) == 0);
/* /*
* TX Test 9: PDCP Entity with SN LEN = 12 * TX Test 9: PDCP Entity with SN LEN = 12

Loading…
Cancel
Save