Adding discard timer timeout to PDCP config.

This commit is contained in:
Pedro Alvarez 2019-11-26 14:01:16 +00:00 committed by Andre Puschmann
parent a049ec6b82
commit e68956bcf6
7 changed files with 88 additions and 34 deletions

View File

@ -144,13 +144,15 @@ public:
security_direction_t tx_direction_,
security_direction_t rx_direction_,
uint8_t sn_len_,
pdcp_t_reordering_t t_reordering_) :
pdcp_t_reordering_t t_reordering_,
pdcp_discard_timer_t discard_timer_) :
bearer_id(bearer_id_),
rb_type(rb_type_),
tx_direction(tx_direction_),
rx_direction(rx_direction_),
sn_len(sn_len_),
t_reordering(t_reordering_)
t_reordering(t_reordering_),
discard_timer(discard_timer_)
{
hdr_len_bytes = ceil((float)sn_len / 8);
}

View File

@ -103,7 +103,8 @@ protected:
SECURITY_DIRECTION_DOWNLINK,
SECURITY_DIRECTION_UPLINK,
PDCP_SN_LEN_12,
pdcp_t_reordering_t::ms500};
pdcp_t_reordering_t::ms500,
pdcp_discard_timer_t::infinity};
std::mutex mutex;

View File

@ -79,7 +79,8 @@ int test_tx(uint32_t n_packets,
srslte::SECURITY_DIRECTION_UPLINK,
srslte::SECURITY_DIRECTION_DOWNLINK,
pdcp_sn_len,
srslte::pdcp_t_reordering_t::ms500};
srslte::pdcp_t_reordering_t::ms500,
srslte::pdcp_discard_timer_t::infinity};
pdcp_nr_test_helper pdcp_hlp(cfg, sec_cfg, log);
srslte::pdcp_entity_nr* pdcp = &pdcp_hlp.pdcp;
@ -121,7 +122,8 @@ int test_rx(std::vector<pdcp_test_event_t> events,
srslte::SECURITY_DIRECTION_DOWNLINK,
srslte::SECURITY_DIRECTION_UPLINK,
pdcp_sn_len,
srslte::pdcp_t_reordering_t::ms500};
srslte::pdcp_t_reordering_t::ms500,
srslte::pdcp_discard_timer_t::infinity};
pdcp_nr_test_helper pdcp_hlp_rx(cfg_rx, sec_cfg, log);
srslte::pdcp_entity_nr* pdcp_rx = &pdcp_hlp_rx.pdcp;
@ -147,6 +149,47 @@ int test_rx(std::vector<pdcp_test_event_t> events,
return 0;
}
/*
* Genric function to test transmission of in-sequence packets
*/
int test_tx_sdu_discard(uint32_t n_packets,
const pdcp_initial_state& init_state,
uint8_t pdcp_sn_len,
uint64_t n_pdus_exp,
srslte::unique_byte_buffer_t pdu_exp,
srslte::byte_buffer_pool* pool,
srslte::log* log)
{
srslte::pdcp_config_t cfg = {1,
srslte::PDCP_RB_IS_DRB,
srslte::SECURITY_DIRECTION_UPLINK,
srslte::SECURITY_DIRECTION_DOWNLINK,
pdcp_sn_len,
srslte::pdcp_t_reordering_t::ms500,
srslte::pdcp_discard_timer_t::ms50};
pdcp_nr_test_helper pdcp_hlp(cfg, sec_cfg, log);
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) {
// Test SDU
srslte::unique_byte_buffer_t sdu = allocate_unique_buffer(*pool);
sdu->append_bytes(sdu1, sizeof(sdu1));
pdcp->write_sdu(std::move(sdu), true);
}
srslte::unique_byte_buffer_t pdu_act = allocate_unique_buffer(*pool);
rlc->get_last_sdu(pdu_act);
TESTASSERT(rlc->rx_count == n_pdus_exp);
TESTASSERT(compare_two_packets(pdu_act, pdu_exp) == 0);
return 0;
}
/*
* TX Test: PDCP Entity with SN LEN = 12 and 18.
* PDCP entity configured with EIA2 and EEA2
@ -287,6 +330,11 @@ int test_tx_all(srslte::byte_buffer_pool* pool, srslte::log* log)
std::move(pdu_exp_count4294967295_len18),
pool,
log) == 0);
/*
* TX Test 9: PDCP Entity with SN LEN = 12
* Test TX PDU discard.
*/
return 0;
}
@ -462,17 +510,10 @@ int run_all_tests(srslte::byte_buffer_pool* pool)
TESTASSERT(test_tx_all(pool, &log) == 0);
TESTASSERT(test_rx_all(pool, &log) == 0);
// Helpers for generating expected PDUs
// srslte::unique_byte_buffer_t sdu = srslte::allocate_unique_buffer(*pool);
// sdu->append_bytes(sdu2, sizeof(sdu2));
// uint32_t tx_next = 1;
// srslte::unique_byte_buffer_t pdu = gen_expected_pdu(std::move(sdu), tx_next, srslte::PDCP_SN_LEN_18, sec_cfg, pool,
// &log); print_packet_array(pdu);
return 0;
}
int main(int argc, char** argv)
int main()
{
if (run_all_tests(srslte::byte_buffer_pool::get_instance()) != SRSLTE_SUCCESS) {
fprintf(stderr, "pdcp_nr_tests() failed\n");

View File

@ -192,7 +192,8 @@ srslte::unique_byte_buffer_t gen_expected_pdu(const srslte::unique_byte_buffer_t
srslte::SECURITY_DIRECTION_UPLINK,
srslte::SECURITY_DIRECTION_DOWNLINK,
pdcp_sn_len,
srslte::pdcp_t_reordering_t::ms500};
srslte::pdcp_t_reordering_t::ms500,
srslte::pdcp_discard_timer_t::infinity};
pdcp_nr_test_helper pdcp_hlp(cfg, sec_cfg, log);
srslte::pdcp_entity_nr* pdcp = &pdcp_hlp.pdcp;

View File

@ -219,8 +219,10 @@ void rrc::add_user(uint16_t rnti)
srslte::SECURITY_DIRECTION_DOWNLINK,
srslte::SECURITY_DIRECTION_UPLINK,
srslte::PDCP_SN_LEN_12,
srslte::pdcp_t_reordering_t::ms500};
uint32_t teid_in = 1;
srslte::pdcp_t_reordering_t::ms500,
srslte::pdcp_discard_timer_t::infinity};
uint32_t teid_in = 1;
for (auto& mbms_item : mcch.msg.c1().mbsfn_area_cfg_r9().pmch_info_list_r9[0].mbms_session_info_list_r9) {
uint32_t lcid = mbms_item.lc_ch_id_r9;
@ -1642,7 +1644,8 @@ void rrc::ue::send_connection_setup(bool is_setup)
srslte::SECURITY_DIRECTION_DOWNLINK,
srslte::SECURITY_DIRECTION_UPLINK,
srslte::PDCP_SN_LEN_5,
srslte::pdcp_t_reordering_t::ms500};
srslte::pdcp_t_reordering_t::ms500,
srslte::pdcp_discard_timer_t::infinity};
parent->pdcp->add_bearer(rnti, 1, pdcp_cnfg);
@ -1859,7 +1862,8 @@ void rrc::ue::send_connection_reconf(srslte::unique_byte_buffer_t pdu)
srslte::SECURITY_DIRECTION_DOWNLINK,
srslte::SECURITY_DIRECTION_UPLINK,
srslte::PDCP_SN_LEN_5,
srslte::pdcp_t_reordering_t::ms500};
srslte::pdcp_t_reordering_t::ms500,
srslte::pdcp_discard_timer_t::infinity};
parent->pdcp->add_bearer(rnti, 2, pdcp_cnfg_srb);
parent->pdcp->config_security(rnti, 2, k_rrc_enc, k_rrc_int, k_up_enc, cipher_algo, integ_algo);
@ -1875,7 +1879,8 @@ void rrc::ue::send_connection_reconf(srslte::unique_byte_buffer_t pdu)
srslte::SECURITY_DIRECTION_DOWNLINK,
srslte::SECURITY_DIRECTION_UPLINK,
srslte::PDCP_SN_LEN_12,
srslte::pdcp_t_reordering_t::ms500};
srslte::pdcp_t_reordering_t::ms500,
srslte::pdcp_discard_timer_t::infinity};
if (conn_reconf->rr_cfg_ded.drb_to_add_mod_list[0].pdcp_cfg.rlc_um_present) {
if (conn_reconf->rr_cfg_ded.drb_to_add_mod_list[0].pdcp_cfg.rlc_um.pdcp_sn_size.value ==
@ -1952,7 +1957,8 @@ void rrc::ue::send_connection_reconf_new_bearer(LIBLTE_S1AP_E_RABTOBESETUPLISTBE
srslte::SECURITY_DIRECTION_DOWNLINK,
srslte::SECURITY_DIRECTION_UPLINK,
srslte::PDCP_SN_LEN_12,
srslte::pdcp_t_reordering_t::ms500};
srslte::pdcp_t_reordering_t::ms500,
srslte::pdcp_discard_timer_t::infinity};
parent->pdcp->add_bearer(rnti, lcid, pdcp_config);

View File

@ -2565,12 +2565,13 @@ void rrc::handle_con_reest(rrc_conn_reest_s* setup)
void rrc::add_srb(srb_to_add_mod_s* srb_cnfg)
{
// Setup PDCP
pdcp_config_t pdcp_cfg = {.bearer_id = srb_cnfg->srb_id,
.rb_type = PDCP_RB_IS_SRB,
.tx_direction = SECURITY_DIRECTION_UPLINK,
.rx_direction = SECURITY_DIRECTION_DOWNLINK,
.sn_len = PDCP_SN_LEN_5,
.t_reordering = pdcp_t_reordering_t::ms500};
pdcp_config_t pdcp_cfg = {.bearer_id = srb_cnfg->srb_id,
.rb_type = PDCP_RB_IS_SRB,
.tx_direction = SECURITY_DIRECTION_UPLINK,
.rx_direction = SECURITY_DIRECTION_DOWNLINK,
.sn_len = PDCP_SN_LEN_5,
.t_reordering = pdcp_t_reordering_t::ms500,
.discard_timer = pdcp_discard_timer_t::infinity};
pdcp->add_bearer(srb_cnfg->srb_id, pdcp_cfg);
if (RB_ID_SRB2 == srb_cnfg->srb_id) {
@ -2644,12 +2645,13 @@ void rrc::add_drb(drb_to_add_mod_s* drb_cnfg)
}
// Setup PDCP
pdcp_config_t pdcp_cfg = {.bearer_id = drb_cnfg->drb_id,
.rb_type = PDCP_RB_IS_DRB,
.tx_direction = SECURITY_DIRECTION_UPLINK,
.rx_direction = SECURITY_DIRECTION_DOWNLINK,
.sn_len = PDCP_SN_LEN_12,
.t_reordering = pdcp_t_reordering_t::ms500};
pdcp_config_t pdcp_cfg = {.bearer_id = drb_cnfg->drb_id,
.rb_type = PDCP_RB_IS_DRB,
.tx_direction = SECURITY_DIRECTION_UPLINK,
.rx_direction = SECURITY_DIRECTION_DOWNLINK,
.sn_len = PDCP_SN_LEN_12,
.t_reordering = pdcp_t_reordering_t::ms500,
.discard_timer = pdcp_discard_timer_t::infinity};
if (drb_cnfg->pdcp_cfg.rlc_um_present) {
if (drb_cnfg->pdcp_cfg.rlc_um.pdcp_sn_size == pdcp_cfg_s::rlc_um_s_::pdcp_sn_size_e_::len7bits) {

View File

@ -221,7 +221,8 @@ private:
.tx_direction = SECURITY_DIRECTION_DOWNLINK,
.rx_direction = SECURITY_DIRECTION_UPLINK,
.sn_len = PDCP_SN_LEN_5,
.t_reorderding = srslte::pdcp_t_reordering_t::ms500};
.t_reorderding = srslte::pdcp_t_reordering_t::ms500,
.discard_timer = srslte::pdcp_discard_timer_t::infinity};
syssim->add_srb(lcid, pdcp_cfg);
}
} else if (config.HasMember("Release")) {
@ -601,4 +602,4 @@ private:
byte_buffer_pool* pool = nullptr;
};
#endif // SRSUE_TTCN3_SYS_INTERFACE_H
#endif // SRSUE_TTCN3_SYS_INTERFACE_H