Starting to add PDCP NR state variables.

This commit is contained in:
Pedro Alvarez 2019-07-02 18:53:41 +01:00 committed by Andre Puschmann
parent 2449f901f0
commit 52f75c3cf2
3 changed files with 33 additions and 34 deletions

View File

@ -92,14 +92,19 @@ public:
// bool do_rohc;
};
enum class srslte_nr_sn_len_t {
SN_12 = 12,
SN_18 = 18
};
class srslte_pdcp_config_nr_t
{
public:
srslte_pdcp_config_nr_t(uint8_t bearer_id_ = 0,
bool is_control_ = false,
bool is_data_ = false,
uint8_t direction_ = SECURITY_DIRECTION_UPLINK,
uint8_t sn_len_ = 12) :
srslte_pdcp_config_nr_t(uint8_t bearer_id_ = 0,
bool is_control_ = false,
bool is_data_ = false,
uint8_t direction_ = SECURITY_DIRECTION_UPLINK,
srslte_nr_sn_len_t sn_len_ = srslte_nr_sn_len_t::SN_12) :
bearer_id(bearer_id_),
direction(direction_),
is_control(is_control_),
@ -108,14 +113,11 @@ public:
{
}
uint32_t bearer_id;
uint8_t direction;
bool is_control;
bool is_data;
uint8_t sn_len;
// TODO: Support the following configurations
// bool do_rohc;
uint32_t bearer_id;
uint8_t direction;
bool is_control;
bool is_data;
srslte_nr_sn_len_t sn_len;
};
class mac_interface_timers

View File

@ -74,31 +74,22 @@ private:
srslte_pdcp_config_nr_t cfg;
uint32_t rx_count = 0;
uint32_t tx_count = 0;
uint16_t sn_len_bytes = 0;
uint32_t rx_hfn = 0;
uint32_t next_pdcp_rx_sn = 0;
uint32_t reordering_window = 0;
uint32_t last_submitted_pdcp_rx_sn = 0;
uint32_t maximum_pdcp_sn = 0;
void handle_um_drb_pdu(const srslte::unique_byte_buffer_t& pdu);
void handle_am_drb_pdu(const srslte::unique_byte_buffer_t& pdu);
// 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;
// Constants: 3GPP TS 38.323 v15.2.0, section 7.2
uint32_t window_size = 0;
};
/****************************************************************************
* Pack/Unpack helper functions
* Ref: 3GPP TS 36.323 v10.1.0
* Ref: 3GPP TS 38.323 v15.2.0
***************************************************************************/
void pdcp_pack_control_pdu(uint32_t sn, byte_buffer_t *sdu);
void pdcp_unpack_control_pdu(byte_buffer_t *sdu, uint32_t *sn);
void pdcp_pack_data_pdu_short_sn(uint32_t sn, byte_buffer_t *sdu);
void pdcp_unpack_data_pdu_short_sn(byte_buffer_t *sdu, uint32_t *sn);
void pdcp_pack_data_pdu_long_sn(uint32_t sn, byte_buffer_t *sdu);
void pdcp_unpack_data_pdu_long_sn(byte_buffer_t *sdu, uint32_t *sn);
} // namespace srslte
#endif // SRSLTE_PDCP_ENTITY_NR_H

View File

@ -46,6 +46,7 @@ void pdcp_entity_nr::init(srsue::rlc_interface_pdcp* rlc_,
do_encryption = false;
// TODO
sn_len_bytes = (int)cfg.sn_len % 8;
}
// Reestablishment procedure: 36.323 5.2
@ -68,8 +69,8 @@ void pdcp_entity_nr::reset()
void pdcp_entity_nr::write_sdu(unique_byte_buffer_t sdu, bool blocking)
{
log->info_hex(sdu->msg, sdu->N_bytes,
"TX %s SDU, SN: %d, do_integrity = %s, do_encryption = %s",
rrc->get_rb_name(lcid).c_str(), tx_count,
"TX %s SDU, do_integrity = %s, do_encryption = %s",
rrc->get_rb_name(lcid).c_str(),
(do_integrity) ? "true" : "false", (do_encryption) ? "true" : "false");
// TODO
@ -86,6 +87,11 @@ void pdcp_entity_nr::write_pdu(unique_byte_buffer_t pdu)
(do_integrity) ? "true" : "false",
(do_encryption) ? "true" : "false");
// Sanity check
if (pdu->N_bytes <= sn_len_bytes) {
return;
}
// TODO
}