From 8e1b9b9f5bf81de71d2c061be0af5a660665967c Mon Sep 17 00:00:00 2001 From: Pedro Alvarez Date: Wed, 3 Jul 2019 18:51:44 +0100 Subject: [PATCH] Starting to implement the receive function of PDCP NR. --- lib/include/srslte/upper/pdcp_entity_nr.h | 15 +++++---------- lib/src/upper/pdcp_entity_nr.cc | 21 ++++++++++++++++++--- 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/lib/include/srslte/upper/pdcp_entity_nr.h b/lib/include/srslte/upper/pdcp_entity_nr.h index 655edc963..f0986b915 100644 --- a/lib/include/srslte/upper/pdcp_entity_nr.h +++ b/lib/include/srslte/upper/pdcp_entity_nr.h @@ -77,19 +77,14 @@ private: uint16_t sn_len_bytes = 0; // State variables: 3GPP TS 38.323 v15.2.0, section 7.1 - uint32_t tx_next = 0; - uint32_t rx_next = 0; - uint32_t rx_deliv = 0; - uint32_t rx_reord = 0; - + 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. + uint32_t rx_deliv = 0; // COUNT value of first SDU not delivered to upper layers, but still waited for. + uint32_t rx_reord = 0; // COUNT value following the COUNT value of PDCP Data PDU which triggered t-Reordering. + // Constants: 3GPP TS 38.323 v15.2.0, section 7.2 uint32_t window_size = 0; }; -/**************************************************************************** - * Pack/Unpack helper functions - * Ref: 3GPP TS 38.323 v15.2.0 - ***************************************************************************/ - } // namespace srslte #endif // SRSLTE_PDCP_ENTITY_NR_H diff --git a/lib/src/upper/pdcp_entity_nr.cc b/lib/src/upper/pdcp_entity_nr.cc index d0e9aa982..739779e08 100644 --- a/lib/src/upper/pdcp_entity_nr.cc +++ b/lib/src/upper/pdcp_entity_nr.cc @@ -115,11 +115,26 @@ void pdcp_entity_nr::write_pdu(unique_byte_buffer_t pdu) cipher_decript(pdu); // Check valid rcvd_count - if (rcvd_count < rx_deliv /*|| received_before (TODO)*/) { + if (rcvd_count < rx_deliv /*|| check_received_before() TODO*/) { return; // Invalid count, drop. } - // - if(rcvd_count >= rx_next) + // Store PDU in reception buffer + // TODO + + // Update RX_NEXT + if(rcvd_count >= rx_next){ + rx_next = rcvd_count + 1; + } + // Deliver to upper layers (TODO support in order delivery) + if (is_control()) { + rrc->write_pdu(pdu); + } else { + gw->write_pdu(pdu); + } + + // Not clear how to update RX_DELIV without reception buffer (TODO) + + // TODO handle reordering timers }