From 6b41ae7e8b982af7cd00dd3814952dbfdd53b878 Mon Sep 17 00:00:00 2001 From: David Rupprecht Date: Tue, 13 Apr 2021 15:56:51 +0200 Subject: [PATCH] Updated PDCP config struct for rat type --- .../srsran/interfaces/pdcp_interface_types.h | 7 +++++-- lib/include/srsran/upper/pdcp.h | 11 +++++++--- lib/include/srsran/upper/pdcp_entity_base.h | 3 ++- lib/src/asn1/rrc_nr_utils.cc | 3 ++- lib/src/asn1/rrc_utils.cc | 9 ++++++--- lib/src/upper/pdcp.cc | 20 ++++++++++++++++++- lib/test/upper/pdcp_lte_test.h | 3 ++- lib/test/upper/pdcp_lte_test_discard_sdu.cc | 6 ++++-- lib/test/upper/pdcp_lte_test_rx.cc | 3 ++- lib/test/upper/pdcp_lte_test_status_report.cc | 15 +++++++++----- lib/test/upper/pdcp_nr_test.h | 3 ++- lib/test/upper/pdcp_nr_test_discard_sdu.cc | 3 ++- lib/test/upper/pdcp_nr_test_rx.cc | 3 ++- lib/test/upper/pdcp_nr_test_tx.cc | 3 ++- srsenb/src/stack/rrc/rrc_nr.cc | 3 ++- srsue/src/stack/rrc/rrc_nr.cc | 3 ++- srsue/src/stack/ue_stack_lte.cc | 2 +- 17 files changed, 73 insertions(+), 27 deletions(-) diff --git a/lib/include/srsran/interfaces/pdcp_interface_types.h b/lib/include/srsran/interfaces/pdcp_interface_types.h index 399c3c534..f51e232a4 100644 --- a/lib/include/srsran/interfaces/pdcp_interface_types.h +++ b/lib/include/srsran/interfaces/pdcp_interface_types.h @@ -126,7 +126,8 @@ public: uint8_t sn_len_, pdcp_t_reordering_t t_reordering_, pdcp_discard_timer_t discard_timer_, - bool status_report_required_) : + bool status_report_required_, + srsran::srsran_rat_t rat_) : bearer_id(bearer_id_), rb_type(rb_type_), tx_direction(tx_direction_), @@ -134,7 +135,8 @@ public: sn_len(sn_len_), t_reordering(t_reordering_), discard_timer(discard_timer_), - status_report_required(status_report_required_) + status_report_required(status_report_required_), + rat(rat_) { hdr_len_bytes = ceilf((float)sn_len / 8); } @@ -148,6 +150,7 @@ public: pdcp_t_reordering_t t_reordering = pdcp_t_reordering_t::ms500; pdcp_discard_timer_t discard_timer = pdcp_discard_timer_t::infinity; + srsran::srsran_rat_t rat = srsran::srsran_rat_t::lte; bool status_report_required = false; diff --git a/lib/include/srsran/upper/pdcp.h b/lib/include/srsran/upper/pdcp.h index d101bf70d..a3b37c71d 100644 --- a/lib/include/srsran/upper/pdcp.h +++ b/lib/include/srsran/upper/pdcp.h @@ -26,6 +26,10 @@ class pdcp : public srsue::pdcp_interface_rlc, public srsue::pdcp_interface_rrc public: pdcp(srsran::task_sched_handle task_sched_, const char* logname); virtual ~pdcp(); + void init(srsue::rlc_interface_pdcp* rlc_, + srsue::rrc_interface_pdcp* rrc_, + srsue::rrc_interface_pdcp* rrc_nr_, + srsue::gw_interface_pdcp* gw_); void init(srsue::rlc_interface_pdcp* rlc_, srsue::rrc_interface_pdcp* rrc_, srsue::gw_interface_pdcp* gw_); void stop(); @@ -69,9 +73,10 @@ public: void reset_metrics(); private: - srsue::rlc_interface_pdcp* rlc = nullptr; - srsue::rrc_interface_pdcp* rrc = nullptr; - srsue::gw_interface_pdcp* gw = nullptr; + srsue::rlc_interface_pdcp* rlc = nullptr; + srsue::rrc_interface_pdcp* rrc = nullptr; + srsue::rrc_interface_pdcp* rrc_nr = nullptr; + srsue::gw_interface_pdcp* gw = nullptr; srsran::task_sched_handle task_sched; srslog::basic_logger& logger; diff --git a/lib/include/srsran/upper/pdcp_entity_base.h b/lib/include/srsran/upper/pdcp_entity_base.h index 29035197c..55b5d768e 100644 --- a/lib/include/srsran/upper/pdcp_entity_base.h +++ b/lib/include/srsran/upper/pdcp_entity_base.h @@ -151,7 +151,8 @@ protected: PDCP_SN_LEN_12, pdcp_t_reordering_t::ms500, pdcp_discard_timer_t::infinity, - false}; + false, + srsran_rat_t::lte}; srsran::as_security_config_t sec_cfg = {}; diff --git a/lib/src/asn1/rrc_nr_utils.cc b/lib/src/asn1/rrc_nr_utils.cc index f5965107c..70497e0b7 100644 --- a/lib/src/asn1/rrc_nr_utils.cc +++ b/lib/src/asn1/rrc_nr_utils.cc @@ -212,7 +212,8 @@ srsran::pdcp_config_t make_drb_pdcp_config_t(const uint8_t bearer_id, bool is_ue sn_len, t_reordering, discard_timer, - false); + false, + srsran_rat_t::nr); return cfg; } diff --git a/lib/src/asn1/rrc_utils.cc b/lib/src/asn1/rrc_utils.cc index d1428c407..d3a1dc382 100644 --- a/lib/src/asn1/rrc_utils.cc +++ b/lib/src/asn1/rrc_utils.cc @@ -207,7 +207,8 @@ srsran::pdcp_config_t make_srb_pdcp_config_t(const uint8_t bearer_id, bool is_ue PDCP_SN_LEN_5, pdcp_t_reordering_t::ms500, pdcp_discard_timer_t::infinity, - false); + false, + srsran_rat_t::lte); return cfg; } @@ -220,7 +221,8 @@ srsran::pdcp_config_t make_drb_pdcp_config_t(const uint8_t bearer_id, bool is_ue PDCP_SN_LEN_12, pdcp_t_reordering_t::ms500, pdcp_discard_timer_t::infinity, - false); + false, + srsran_rat_t::lte); return cfg; } @@ -325,7 +327,8 @@ srsran::pdcp_config_t make_drb_pdcp_config_t(const uint8_t bearer_id, bool is_ue sn_len, t_reordering, discard_timer, - status_report_required); + status_report_required, + srsran_rat_t::lte); return cfg; } diff --git a/lib/src/upper/pdcp.cc b/lib/src/upper/pdcp.cc index 9bf1e1623..88bc1fa0c 100644 --- a/lib/src/upper/pdcp.cc +++ b/lib/src/upper/pdcp.cc @@ -30,6 +30,15 @@ pdcp::~pdcp() pdcp_array_mrb.clear(); } +void pdcp::init(srsue::rlc_interface_pdcp* rlc_, + srsue::rrc_interface_pdcp* rrc_, + srsue::rrc_interface_pdcp* rrc_nr_, + srsue::gw_interface_pdcp* gw_) +{ + init(rlc_, rrc_, gw_); + rrc_nr = rrc_nr_; +} + void pdcp::init(srsue::rlc_interface_pdcp* rlc_, srsue::rrc_interface_pdcp* rrc_, srsue::gw_interface_pdcp* gw_) { rlc = rlc_; @@ -95,7 +104,16 @@ void pdcp::add_bearer(uint32_t lcid, pdcp_config_t cfg) if (not valid_lcid(lcid)) { std::unique_ptr entity; // For now we create an pdcp entity lte for nr due to it's maturity - entity.reset(new pdcp_entity_lte{rlc, rrc, gw, task_sched, logger, lcid}); + if (cfg.rat == srsran::srsran_rat_t::lte) { + entity.reset(new pdcp_entity_lte{rlc, rrc, gw, task_sched, logger, lcid}); + } else if (cfg.rat == srsran::srsran_rat_t::nr) { + if (rrc_nr == nullptr) { + logger.warning("Cannot add PDCP entity - missing rrc_nr parent pointer"); + return; + } + entity.reset(new pdcp_entity_lte{rlc, rrc_nr, gw, task_sched, logger, lcid}); + } + if (not entity->configure(cfg)) { logger.error("Can not configure PDCP entity"); return; diff --git a/lib/test/upper/pdcp_lte_test.h b/lib/test/upper/pdcp_lte_test.h index 733b686f3..a106b1001 100644 --- a/lib/test/upper/pdcp_lte_test.h +++ b/lib/test/upper/pdcp_lte_test.h @@ -92,7 +92,8 @@ srsran::unique_byte_buffer_t gen_expected_pdu(const srsran::unique_byte_buffer_t pdcp_sn_len, srsran::pdcp_t_reordering_t::ms500, srsran::pdcp_discard_timer_t::infinity, - false}; + false, + srsran::srsran_rat_t::lte}; pdcp_lte_test_helper pdcp_hlp(cfg, sec_cfg, logger); srsran::pdcp_entity_lte* pdcp = &pdcp_hlp.pdcp; diff --git a/lib/test/upper/pdcp_lte_test_discard_sdu.cc b/lib/test/upper/pdcp_lte_test_discard_sdu.cc index 0d230dd62..e869ee080 100644 --- a/lib/test/upper/pdcp_lte_test_discard_sdu.cc +++ b/lib/test/upper/pdcp_lte_test_discard_sdu.cc @@ -26,7 +26,8 @@ int test_tx_sdu_notify(const srsran::pdcp_lte_state_t& init_state, srsran::PDCP_SN_LEN_12, srsran::pdcp_t_reordering_t::ms500, discard_timeout, - false}; + false, + srsran::srsran_rat_t::lte}; pdcp_lte_test_helper pdcp_hlp(cfg, sec_cfg, logger); srsran::pdcp_entity_lte* pdcp = &pdcp_hlp.pdcp; @@ -75,7 +76,8 @@ int test_tx_sdu_discard(const srsran::pdcp_lte_state_t& init_state, srsran::PDCP_SN_LEN_12, srsran::pdcp_t_reordering_t::ms500, discard_timeout, - false}; + false, + srsran::srsran_rat_t::lte}; pdcp_lte_test_helper pdcp_hlp(cfg, sec_cfg, logger); srsran::pdcp_entity_lte* pdcp = &pdcp_hlp.pdcp; diff --git a/lib/test/upper/pdcp_lte_test_rx.cc b/lib/test/upper/pdcp_lte_test_rx.cc index 98fd28a4f..7138a981c 100644 --- a/lib/test/upper/pdcp_lte_test_rx.cc +++ b/lib/test/upper/pdcp_lte_test_rx.cc @@ -31,7 +31,8 @@ int test_rx(std::vector events, pdcp_sn_len, srsran::pdcp_t_reordering_t::ms500, srsran::pdcp_discard_timer_t::infinity, - false}; + false, + srsran::srsran_rat_t::lte}; pdcp_lte_test_helper pdcp_hlp_rx(cfg_rx, sec_cfg, logger); srsran::pdcp_entity_lte* pdcp_rx = &pdcp_hlp_rx.pdcp; diff --git a/lib/test/upper/pdcp_lte_test_status_report.cc b/lib/test/upper/pdcp_lte_test_status_report.cc index 69586d3d3..ab7cca77d 100644 --- a/lib/test/upper/pdcp_lte_test_status_report.cc +++ b/lib/test/upper/pdcp_lte_test_status_report.cc @@ -24,7 +24,8 @@ int test_tx_status_report(const srsran::pdcp_lte_state_t& init_state, srslog::ba srsran::PDCP_SN_LEN_12, srsran::pdcp_t_reordering_t::ms500, srsran::pdcp_discard_timer_t::ms500, - true}; + true, + srsran::srsran_rat_t::lte}; srsran::pdcp_config_t cfg_rx = {1, srsran::PDCP_RB_IS_DRB, @@ -33,7 +34,8 @@ int test_tx_status_report(const srsran::pdcp_lte_state_t& init_state, srslog::ba srsran::PDCP_SN_LEN_12, srsran::pdcp_t_reordering_t::ms500, srsran::pdcp_discard_timer_t::ms500, - true}; + true, + srsran::srsran_rat_t::lte}; // Setup TX pdcp_lte_test_helper pdcp_hlp_tx(cfg_tx, sec_cfg, logger); @@ -128,7 +130,8 @@ int test_tx_wraparound_status_report(const srsran::pdcp_lte_state_t& init_state, srsran::PDCP_SN_LEN_12, srsran::pdcp_t_reordering_t::ms500, srsran::pdcp_discard_timer_t::ms500, - true}; + true, + srsran::srsran_rat_t::lte}; srsran::pdcp_config_t cfg_rx = {1, srsran::PDCP_RB_IS_DRB, @@ -137,7 +140,8 @@ int test_tx_wraparound_status_report(const srsran::pdcp_lte_state_t& init_state, srsran::PDCP_SN_LEN_12, srsran::pdcp_t_reordering_t::ms500, srsran::pdcp_discard_timer_t::ms500, - true}; + true, + srsran::srsran_rat_t::lte}; // Setup TX pdcp_lte_test_helper pdcp_hlp_tx(cfg_tx, sec_cfg, logger); @@ -240,7 +244,8 @@ int test_rx_status_report(const srsran::pdcp_lte_state_t& init_state, srslog::ba srsran::PDCP_SN_LEN_12, srsran::pdcp_t_reordering_t::ms500, srsran::pdcp_discard_timer_t::ms500, - true}; + true, + srsran::srsran_rat_t::lte}; pdcp_lte_test_helper pdcp_hlp(cfg, sec_cfg, logger); srsran::pdcp_entity_lte* pdcp = &pdcp_hlp.pdcp; diff --git a/lib/test/upper/pdcp_nr_test.h b/lib/test/upper/pdcp_nr_test.h index 88ab0c1c3..40fc24b7d 100644 --- a/lib/test/upper/pdcp_nr_test.h +++ b/lib/test/upper/pdcp_nr_test.h @@ -125,7 +125,8 @@ srsran::unique_byte_buffer_t gen_expected_pdu(const srsran::unique_byte_buffer_t pdcp_sn_len, srsran::pdcp_t_reordering_t::ms500, srsran::pdcp_discard_timer_t::infinity, - false}; + false, + srsran::srsran_rat_t::nr}; pdcp_nr_test_helper pdcp_hlp(cfg, sec_cfg, logger); srsran::pdcp_entity_nr* pdcp = &pdcp_hlp.pdcp; diff --git a/lib/test/upper/pdcp_nr_test_discard_sdu.cc b/lib/test/upper/pdcp_nr_test_discard_sdu.cc index 6b3da0944..bbd21bade 100644 --- a/lib/test/upper/pdcp_nr_test_discard_sdu.cc +++ b/lib/test/upper/pdcp_nr_test_discard_sdu.cc @@ -27,7 +27,8 @@ int test_tx_sdu_discard(const pdcp_initial_state& init_state, srsran::PDCP_SN_LEN_12, srsran::pdcp_t_reordering_t::ms500, discard_timeout, - false}; + false, + srsran::srsran_rat_t::nr}; pdcp_nr_test_helper pdcp_hlp(cfg, sec_cfg, logger); srsran::pdcp_entity_nr* pdcp = &pdcp_hlp.pdcp; diff --git a/lib/test/upper/pdcp_nr_test_rx.cc b/lib/test/upper/pdcp_nr_test_rx.cc index 414009891..3f5397f3a 100644 --- a/lib/test/upper/pdcp_nr_test_rx.cc +++ b/lib/test/upper/pdcp_nr_test_rx.cc @@ -30,7 +30,8 @@ int test_rx(std::vector events, pdcp_sn_len, srsran::pdcp_t_reordering_t::ms500, srsran::pdcp_discard_timer_t::infinity, - false}; + false, + srsran::srsran_rat_t::nr}; pdcp_nr_test_helper pdcp_hlp_rx(cfg_rx, sec_cfg, logger); srsran::pdcp_entity_nr* pdcp_rx = &pdcp_hlp_rx.pdcp; diff --git a/lib/test/upper/pdcp_nr_test_tx.cc b/lib/test/upper/pdcp_nr_test_tx.cc index acdfc7b19..452f72450 100644 --- a/lib/test/upper/pdcp_nr_test_tx.cc +++ b/lib/test/upper/pdcp_nr_test_tx.cc @@ -29,7 +29,8 @@ int test_tx(uint32_t n_packets, pdcp_sn_len, srsran::pdcp_t_reordering_t::ms500, srsran::pdcp_discard_timer_t::infinity, - false}; + false, + srsran::srsran_rat_t::nr}; pdcp_nr_test_helper pdcp_hlp(cfg, sec_cfg, logger); srsran::pdcp_entity_nr* pdcp = &pdcp_hlp.pdcp; diff --git a/srsenb/src/stack/rrc/rrc_nr.cc b/srsenb/src/stack/rrc/rrc_nr.cc index 9ec9719da..e874cf35f 100644 --- a/srsenb/src/stack/rrc/rrc_nr.cc +++ b/srsenb/src/stack/rrc/rrc_nr.cc @@ -65,7 +65,8 @@ int rrc_nr::init(const rrc_nr_cfg_t& cfg_, srsran::PDCP_SN_LEN_18, srsran::pdcp_t_reordering_t::ms500, srsran::pdcp_discard_timer_t::infinity, - false}; + false, + srsran::srsran_rat_t::nr}; pdcp->add_bearer(cfg.coreless.rnti, cfg.coreless.drb_lcid, pdcp_cnfg); logger.info("Started"); diff --git a/srsue/src/stack/rrc/rrc_nr.cc b/srsue/src/stack/rrc/rrc_nr.cc index dd7e94ed6..556ba516c 100644 --- a/srsue/src/stack/rrc/rrc_nr.cc +++ b/srsue/src/stack/rrc/rrc_nr.cc @@ -79,7 +79,8 @@ void rrc_nr::init_core_less() srsran::PDCP_SN_LEN_18, srsran::pdcp_t_reordering_t::ms500, srsran::pdcp_discard_timer_t::ms100, - false}; + false, + srsran_rat_t::nr}; pdcp->add_bearer(args.coreless.drb_lcid, pdcp_cnfg); return; diff --git a/srsue/src/stack/ue_stack_lte.cc b/srsue/src/stack/ue_stack_lte.cc index 5a92b142e..991d9697e 100644 --- a/srsue/src/stack/ue_stack_lte.cc +++ b/srsue/src/stack/ue_stack_lte.cc @@ -202,7 +202,7 @@ int ue_stack_lte::init(const stack_args_t& args_) mac.init(phy, &rlc, &rrc); rlc.init(&pdcp, &rrc, task_sched.get_timer_handler(), 0 /* RB_ID_SRB0 */); - pdcp.init(&rlc, &rrc, gw); + pdcp.init(&rlc, &rrc, &rrc_nr, gw); nas.init(usim.get(), &rrc, gw, args.nas); mac_nr_args_t mac_nr_args = {};