From fb088a8c54862a397b78b522a4609160106038a5 Mon Sep 17 00:00:00 2001 From: Pedro Alvarez Date: Mon, 15 Jun 2020 11:37:50 +0100 Subject: [PATCH] Restoring PDCP state only when using RLC AM. --- srsenb/hdr/stack/rrc/rrc_ue.h | 12 ++++++------ srsenb/src/stack/rrc/rrc_ue.cc | 36 +++++++++++++++++++++++++--------- 2 files changed, 33 insertions(+), 15 deletions(-) diff --git a/srsenb/hdr/stack/rrc/rrc_ue.h b/srsenb/hdr/stack/rrc/rrc_ue.h index 6c9b4da71..25009503b 100644 --- a/srsenb/hdr/stack/rrc/rrc_ue.h +++ b/srsenb/hdr/stack/rrc/rrc_ue.h @@ -120,12 +120,12 @@ private: uint8_t mmec = 0; // state - sched_interface::ue_cfg_t current_sched_ue_cfg = {}; - uint32_t rlf_cnt = 0; - uint8_t transaction_id = 0; - rrc_state_t state = RRC_STATE_IDLE; - uint16_t old_reest_rnti = SRSLTE_INVALID_RNTI; - srslte::pdcp_lte_state_t old_reest_pdcp_state = {}; + sched_interface::ue_cfg_t current_sched_ue_cfg = {}; + uint32_t rlf_cnt = 0; + uint8_t transaction_id = 0; + rrc_state_t state = RRC_STATE_IDLE; + uint16_t old_reest_rnti = SRSLTE_INVALID_RNTI; + std::map old_reest_pdcp_state = {}; asn1::s1ap::ue_aggregate_maximum_bitrate_s bitrates; bool eutra_capabilities_unpacked = false; diff --git a/srsenb/src/stack/rrc/rrc_ue.cc b/srsenb/src/stack/rrc/rrc_ue.cc index 8409547b6..f5f6e2078 100644 --- a/srsenb/src/stack/rrc/rrc_ue.cc +++ b/srsenb/src/stack/rrc/rrc_ue.cc @@ -365,14 +365,19 @@ void rrc::ue::handle_rrc_con_reest_req(rrc_conn_reest_request_s* msg) parent->gtpu->mod_bearer_rnti(old_rnti, rnti); // Get PDCP entity state (required when using RLC AM) - parent->pdcp->get_state(old_rnti, 3, &old_reest_pdcp_state); - - parent->rrc_log->debug( - "Got PDCP state: TX COUNT %d, RX_HFN %d, NEXT_PDCP_RX_SN %d, LAST_SUBMITTED_PDCP_RX_SN %d\n", - old_reest_pdcp_state.tx_count, - old_reest_pdcp_state.rx_hfn, - old_reest_pdcp_state.next_pdcp_rx_sn, - old_reest_pdcp_state.last_submitted_pdcp_rx_sn); + for (const auto& erab_pair : parent->users[old_rnti]->bearer_list.get_erabs()) { + uint16_t lcid = erab_pair.second.id - 2; + old_reest_pdcp_state[lcid] = {}; + parent->pdcp->get_state(old_rnti, lcid, &old_reest_pdcp_state[lcid]); + + parent->rrc_log->debug("Getting PDCP state for E-RAB with LCID %d\n", lcid); + parent->rrc_log->debug( + "Got PDCP state: TX COUNT %d, RX_HFN %d, NEXT_PDCP_RX_SN %d, LAST_SUBMITTED_PDCP_RX_SN %d\n", + old_reest_pdcp_state[lcid].tx_count, + old_reest_pdcp_state[lcid].rx_hfn, + old_reest_pdcp_state[lcid].next_pdcp_rx_sn, + old_reest_pdcp_state[lcid].last_submitted_pdcp_rx_sn); + } old_reest_rnti = old_rnti; state = RRC_STATE_WAIT_FOR_CON_REEST_COMPLETE; @@ -558,7 +563,20 @@ void rrc::ue::send_connection_reconf(srslte::unique_byte_buffer_t pdu) // If reconf due to reestablishment, recover PDCP state if (state == RRC_STATE_REESTABLISHMENT_COMPLETE) { - parent->pdcp->set_state(rnti, 3, old_reest_pdcp_state); + for (const auto& erab_pair : bearer_list.get_erabs()) { + uint16_t lcid = erab_pair.second.id - 2; + bool is_am = parent->cfg.qci_cfg[erab_pair.second.qos_params.qci].rlc_cfg.type().value == + asn1::rrc::rlc_cfg_c::types_opts::am; + if (is_am) { + parent->rrc_log->debug( + "Set PDCP state: TX COUNT %d, RX_HFN %d, NEXT_PDCP_RX_SN %d, LAST_SUBMITTED_PDCP_RX_SN %d\n", + old_reest_pdcp_state[lcid].tx_count, + old_reest_pdcp_state[lcid].rx_hfn, + old_reest_pdcp_state[lcid].next_pdcp_rx_sn, + old_reest_pdcp_state[lcid].last_submitted_pdcp_rx_sn); + parent->pdcp->set_state(rnti, lcid, old_reest_pdcp_state[lcid]); + } + } } // Reuse same PDU