From a42726f836bc6c5f633f8b7dbf14d48dbafe40ca Mon Sep 17 00:00:00 2001 From: Pedro Alvarez Date: Wed, 10 Jul 2019 15:31:29 +0100 Subject: [PATCH] Fixed hdr_len_bytes in PDCP NR. Tx seems OK now. --- lib/include/srslte/upper/pdcp_entity_nr.h | 2 -- lib/src/upper/pdcp_entity_nr.cc | 8 ++++---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/include/srslte/upper/pdcp_entity_nr.h b/lib/include/srslte/upper/pdcp_entity_nr.h index 7e95156d9..c182270e2 100644 --- a/lib/include/srslte/upper/pdcp_entity_nr.h +++ b/lib/include/srslte/upper/pdcp_entity_nr.h @@ -64,8 +64,6 @@ private: srsue::rrc_interface_pdcp* rrc = nullptr; srsue::gw_interface_pdcp* gw = nullptr; - uint16_t sn_len_bytes = 0; - // State variables: 3GPP TS 38.323 v15.2.0, section 7.1 uint32_t tx_next = 0; // COUNT value of next SDU to be transmitted. uint32_t rx_next = 0; // COUNT value of next SDU expected to be received. diff --git a/lib/src/upper/pdcp_entity_nr.cc b/lib/src/upper/pdcp_entity_nr.cc index 4027792cb..30ed08600 100644 --- a/lib/src/upper/pdcp_entity_nr.cc +++ b/lib/src/upper/pdcp_entity_nr.cc @@ -103,7 +103,7 @@ void pdcp_entity_nr::write_pdu(unique_byte_buffer_t pdu) (do_encryption) ? "true" : "false"); // Sanity check - if (pdu->N_bytes <= sn_len_bytes) { + if (pdu->N_bytes <= cfg.hdr_len_bytes) { return; } @@ -173,12 +173,12 @@ uint32_t pdcp_entity_nr::get_rcvd_sn(const unique_byte_buffer_t& pdu) void pdcp_entity_nr::write_data_header(const srslte::unique_byte_buffer_t& sdu, uint32_t count) { // Check enough space for header - if (sn_len_bytes > sdu->get_headroom()) { + if (cfg.hdr_len_bytes > sdu->get_headroom()) { log->error("Not enough space to add header\n"); return; } - sdu->msg -= sn_len_bytes; - sdu->N_bytes += sn_len_bytes; + sdu->msg -= cfg.hdr_len_bytes; + sdu->N_bytes += cfg.hdr_len_bytes; switch (cfg.sn_len) { case PDCP_SN_LEN_12: