diff --git a/lib/include/srslte/common/interfaces_common.h b/lib/include/srslte/common/interfaces_common.h index 5a88563de..ad3d18050 100644 --- a/lib/include/srslte/common/interfaces_common.h +++ b/lib/include/srslte/common/interfaces_common.h @@ -76,7 +76,7 @@ const uint8_t PDCP_SN_LEN_18 = 18; typedef enum { PDCP_RB_IS_SRB, PDCP_RB_IS_DRB } pdcp_rb_type_t; -// Take from PDCP-Config (TS 38.331 version 15.2.1) +// Taken from PDCP-Config (TS 38.331 version 15.2.1) enum class pdcp_t_reordering_t { ms0 = 0, ms1 = 1, @@ -116,6 +116,26 @@ enum class pdcp_t_reordering_t { ms3000 = 3000 }; +// Taken from PDCP-Config (TS 38.331 version 15.2.1) +enum class pdcp_discard_timer_t { + ms10 = 10, + ms20 = 20, + ms30 = 30, + ms40 = 40, + ms50 = 50, + ms60 = 60, + ms75 = 75, + ms100 = 100, + ms150 = 150, + ms200 = 200, + ms250 = 250, + ms300 = 300, + ms500 = 500, + ms750 = 750, + ms1500 = 1500, + infinity = 0 +}; + class pdcp_config_t { public: @@ -142,7 +162,8 @@ public: uint8_t sn_len = PDCP_SN_LEN_12; uint8_t hdr_len_bytes = 2; - pdcp_t_reordering_t t_reordering = pdcp_t_reordering_t::ms500; + pdcp_t_reordering_t t_reordering = pdcp_t_reordering_t::ms500; + pdcp_discard_timer_t discard_timer = pdcp_discard_timer_t::infinity; // TODO: Support the following configurations // bool do_rohc; diff --git a/lib/src/upper/pdcp_entity_nr.cc b/lib/src/upper/pdcp_entity_nr.cc index 247924b2f..3bc8fe060 100644 --- a/lib/src/upper/pdcp_entity_nr.cc +++ b/lib/src/upper/pdcp_entity_nr.cc @@ -73,7 +73,7 @@ void pdcp_entity_nr::reestablish() void pdcp_entity_nr::reset() { active = false; - if (log) { + if (log != nullptr) { log->debug("Reset %s\n", rrc->get_rb_name(lcid).c_str()); } } @@ -103,7 +103,12 @@ void pdcp_entity_nr::write_sdu(unique_byte_buffer_t sdu, bool blocking) tx_overflow = true; } - // Start discard timer TODO + // Start discard timer + if (cfg.discard_timer != pdcp_discard_timer_t::infinity) { + timer_handler::unique_timer discard_timer = timers->get_unique_timer(); + reordering_timer.set(static_cast(cfg.discard_timer), [](uint32_t tid) {}); + } + // Perform header compression TODO // Integrity protection