From faf2adde90efc2c999f52f5d9a916de917549a8d Mon Sep 17 00:00:00 2001 From: Francisco Date: Tue, 16 Feb 2021 18:42:25 +0000 Subject: [PATCH] set last_submitted_pdcp_rx_sn to -1 of the next ul rx sn --- lib/include/srslte/asn1/rrc_utils.h | 2 +- lib/src/asn1/rrc_utils.cc | 18 ++++++++++++------ srsenb/src/stack/rrc/rrc_mobility.cc | 4 +++- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/lib/include/srslte/asn1/rrc_utils.h b/lib/include/srslte/asn1/rrc_utils.h index bd11ae1d8..261a21d94 100644 --- a/lib/include/srslte/asn1/rrc_utils.h +++ b/lib/include/srslte/asn1/rrc_utils.h @@ -75,7 +75,6 @@ struct ue_eutra_cap_s; * Conversion Helpers ***********************/ namespace srslte { - plmn_id_t make_plmn_id_t(const asn1::rrc::plmn_id_s& asn1_type); void to_asn1(asn1::rrc::plmn_id_s* asn1_type, const plmn_id_t& cfg); plmn_id_t make_plmn_id_t(const asn1::fixed_octstring<3, true>& asn1_type); @@ -96,6 +95,7 @@ void to_asn1(asn1::rrc::rlc_cfg_c* asn1_type, const rlc_config_t& cfg); **************************/ srslte::pdcp_config_t make_srb_pdcp_config_t(const uint8_t bearer_id, bool is_ue); srslte::pdcp_config_t make_drb_pdcp_config_t(const uint8_t bearer_id, bool is_ue); +uint8_t get_pdcp_drb_sn_len(const asn1::rrc::pdcp_cfg_s& pdcp_cfg); srslte::pdcp_config_t make_drb_pdcp_config_t(const uint8_t bearer_id, bool is_ue, const asn1::rrc::pdcp_cfg_s& pdcp_cfg); diff --git a/lib/src/asn1/rrc_utils.cc b/lib/src/asn1/rrc_utils.cc index d51dd6c6e..04a08908f 100644 --- a/lib/src/asn1/rrc_utils.cc +++ b/lib/src/asn1/rrc_utils.cc @@ -224,6 +224,17 @@ srslte::pdcp_config_t make_drb_pdcp_config_t(const uint8_t bearer_id, bool is_ue return cfg; } +uint8_t get_pdcp_drb_sn_len(const pdcp_cfg_s& pdcp_cfg) +{ + uint8_t sn_len = srslte::PDCP_SN_LEN_12; + if (pdcp_cfg.rlc_um_present) { + if (pdcp_cfg.rlc_um.pdcp_sn_size.value == pdcp_cfg_s::rlc_um_s_::pdcp_sn_size_e_::len7bits) { + sn_len = srslte::PDCP_SN_LEN_7; + } + } + return sn_len; +} + srslte::pdcp_config_t make_drb_pdcp_config_t(const uint8_t bearer_id, bool is_ue, const asn1::rrc::pdcp_cfg_s& pdcp_cfg) { // TODO: complete config processing @@ -250,12 +261,7 @@ srslte::pdcp_config_t make_drb_pdcp_config_t(const uint8_t bearer_id, bool is_ue } } - uint8_t sn_len = srslte::PDCP_SN_LEN_12; - if (pdcp_cfg.rlc_um_present) { - if (pdcp_cfg.rlc_um.pdcp_sn_size.value == pdcp_cfg_s::rlc_um_s_::pdcp_sn_size_e_::len7bits) { - sn_len = srslte::PDCP_SN_LEN_7; - } - } + uint8_t sn_len = get_pdcp_drb_sn_len(pdcp_cfg); bool status_report_required = false; if (pdcp_cfg.rlc_am_present) { diff --git a/srsenb/src/stack/rrc/rrc_mobility.cc b/srsenb/src/stack/rrc/rrc_mobility.cc index 01722ba5e..4566c5a92 100644 --- a/srsenb/src/stack/rrc/rrc_mobility.cc +++ b/srsenb/src/stack/rrc/rrc_mobility.cc @@ -887,7 +887,9 @@ void rrc::ue::rrc_mobility::handle_status_transfer(s1_target_ho_st& s, const sta drb_state.next_pdcp_tx_sn = erab_item.dl_coun_tvalue.pdcp_sn; drb_state.rx_hfn = erab_item.ul_coun_tvalue.hfn; drb_state.next_pdcp_rx_sn = erab_item.ul_coun_tvalue.pdcp_sn; - drb_state.last_submitted_pdcp_rx_sn = erab_item.ul_coun_tvalue.pdcp_sn; + uint8_t sn_len = srslte::get_pdcp_drb_sn_len(drb_it->pdcp_cfg); + uint32_t maximum_pdcp_sn = (1u << sn_len) - 1u; + drb_state.last_submitted_pdcp_rx_sn = std::max(erab_item.ul_coun_tvalue.pdcp_sn - 1u, maximum_pdcp_sn); logger.info("Setting lcid=%d PDCP state to {Tx SN: %d, Rx SN: %d}", drb_it->lc_ch_id, drb_state.next_pdcp_tx_sn,