diff --git a/lib/include/srslte/interfaces/rrc_interface_types.h b/lib/include/srslte/interfaces/rrc_interface_types.h index d4412bbd0..caaa532a1 100644 --- a/lib/include/srslte/interfaces/rrc_interface_types.h +++ b/lib/include/srslte/interfaces/rrc_interface_types.h @@ -256,6 +256,40 @@ public: rlc_cfg.am.t_status_prohibit = 0; return rlc_cfg; } + static rlc_config_t default_rlc_um_config(uint32_t sn_size = 10) + { + rlc_config_t cnfg; + cnfg.rlc_mode = rlc_mode_t::um; + cnfg.um.t_reordering = 5; + if (sn_size == 10) { + cnfg.um.rx_sn_field_length = rlc_umd_sn_size_t::size10bits; + cnfg.um.rx_window_size = 512; + cnfg.um.rx_mod = 1024; + cnfg.um.tx_sn_field_length = rlc_umd_sn_size_t::size10bits; + cnfg.um.tx_mod = 1024; + } else if (sn_size == 5) { + cnfg.um.rx_sn_field_length = rlc_umd_sn_size_t::size5bits; + cnfg.um.rx_window_size = 16; + cnfg.um.rx_mod = 32; + cnfg.um.tx_sn_field_length = rlc_umd_sn_size_t::size5bits; + cnfg.um.tx_mod = 32; + } else { + return {}; + } + return cnfg; + } + static rlc_config_t default_rlc_am_config() + { + rlc_config_t rlc_cnfg; + rlc_cnfg.rlc_mode = rlc_mode_t::am; + rlc_cnfg.am.t_reordering = 5; + rlc_cnfg.am.t_status_prohibit = 5; + rlc_cnfg.am.max_retx_thresh = 4; + rlc_cnfg.am.poll_byte = 25; + rlc_cnfg.am.poll_pdu = 4; + rlc_cnfg.am.t_poll_retx = 5; + return rlc_cnfg; + } }; } // namespace srslte diff --git a/lib/test/upper/rlc_am_test.cc b/lib/test/upper/rlc_am_test.cc index 99fa0b2f8..aa3bbcd1d 100644 --- a/lib/test/upper/rlc_am_test.cc +++ b/lib/test/upper/rlc_am_test.cc @@ -129,19 +129,6 @@ private: bool running; }; -rlc_config_t default_rlc_cnfg() -{ - rlc_config_t rlc_cnfg; - rlc_cnfg.rlc_mode = rlc_mode_t::am; - rlc_cnfg.am.t_reordering = 5; - rlc_cnfg.am.t_status_prohibit = 5; - rlc_cnfg.am.max_retx_thresh = 4; - rlc_cnfg.am.poll_byte = 25; - rlc_cnfg.am.poll_pdu = 4; - rlc_cnfg.am.t_poll_retx = 5; - return rlc_cnfg; -} - void basic_test_tx(rlc_am* rlc, byte_buffer_t pdu_bufs[NBUFS]) { @@ -182,11 +169,11 @@ bool basic_test() rlc_am rlc1(&log1, 1, &tester, &tester, &timers); rlc_am rlc2(&log2, 1, &tester, &tester, &timers); - if (not rlc1.configure(default_rlc_cnfg())) { + if (not rlc1.configure(rlc_config_t::default_rlc_am_config())) { return -1; } - if (not rlc2.configure(default_rlc_cnfg())) { + if (not rlc2.configure(rlc_config_t::default_rlc_am_config())) { return -1; } @@ -241,11 +228,11 @@ bool concat_test() rlc_am rlc1(&log1, 1, &tester, &tester, &timers); rlc_am rlc2(&log2, 1, &tester, &tester, &timers); - if (not rlc1.configure(default_rlc_cnfg())) { + if (not rlc1.configure(rlc_config_t::default_rlc_am_config())) { return -1; } - if (not rlc2.configure(default_rlc_cnfg())) { + if (not rlc2.configure(rlc_config_t::default_rlc_am_config())) { return -1; } @@ -307,11 +294,11 @@ bool segment_test(bool in_seq_rx) rlc_am rlc1(&log1, 1, &tester, &tester, &timers); rlc_am rlc2(&log2, 1, &tester, &tester, &timers); - if (not rlc1.configure(default_rlc_cnfg())) { + if (not rlc1.configure(rlc_config_t::default_rlc_am_config())) { return -1; } - if (not rlc2.configure(default_rlc_cnfg())) { + if (not rlc2.configure(rlc_config_t::default_rlc_am_config())) { return -1; } @@ -401,11 +388,11 @@ bool retx_test() rlc_am rlc1(&log1, 1, &tester, &tester, &timers); rlc_am rlc2(&log2, 1, &tester, &tester, &timers); - if (not rlc1.configure(default_rlc_cnfg())) { + if (not rlc1.configure(rlc_config_t::default_rlc_am_config())) { return -1; } - if (not rlc2.configure(default_rlc_cnfg())) { + if (not rlc2.configure(rlc_config_t::default_rlc_am_config())) { return -1; } @@ -494,11 +481,11 @@ bool resegment_test_1() rlc_am rlc1(&log1, 1, &tester, &tester, &timers); rlc_am rlc2(&log2, 1, &tester, &tester, &timers); - if (not rlc1.configure(default_rlc_cnfg())) { + if (not rlc1.configure(rlc_config_t::default_rlc_am_config())) { return -1; } - if (not rlc2.configure(default_rlc_cnfg())) { + if (not rlc2.configure(rlc_config_t::default_rlc_am_config())) { return -1; } @@ -600,11 +587,11 @@ bool resegment_test_2() rlc_am rlc1(&log1, 1, &tester, &tester, &timers); rlc_am rlc2(&log2, 1, &tester, &tester, &timers); - if (not rlc1.configure(default_rlc_cnfg())) { + if (not rlc1.configure(rlc_config_t::default_rlc_am_config())) { return -1; } - if (not rlc2.configure(default_rlc_cnfg())) { + if (not rlc2.configure(rlc_config_t::default_rlc_am_config())) { return -1; } @@ -702,11 +689,11 @@ bool resegment_test_3() rlc_am rlc1(&log1, 1, &tester, &tester, &timers); rlc_am rlc2(&log2, 1, &tester, &tester, &timers); - if (not rlc1.configure(default_rlc_cnfg())) { + if (not rlc1.configure(rlc_config_t::default_rlc_am_config())) { return -1; } - if (not rlc2.configure(default_rlc_cnfg())) { + if (not rlc2.configure(rlc_config_t::default_rlc_am_config())) { return -1; } @@ -799,11 +786,11 @@ bool resegment_test_4() rlc_am rlc1(&log1, 1, &tester, &tester, &timers); rlc_am rlc2(&log2, 1, &tester, &tester, &timers); - if (not rlc1.configure(default_rlc_cnfg())) { + if (not rlc1.configure(rlc_config_t::default_rlc_am_config())) { return -1; } - if (not rlc2.configure(default_rlc_cnfg())) { + if (not rlc2.configure(rlc_config_t::default_rlc_am_config())) { return -1; } @@ -898,11 +885,11 @@ bool resegment_test_5() rlc_am rlc1(&log1, 1, &tester, &tester, &timers); rlc_am rlc2(&log2, 1, &tester, &tester, &timers); - if (not rlc1.configure(default_rlc_cnfg())) { + if (not rlc1.configure(rlc_config_t::default_rlc_am_config())) { return -1; } - if (not rlc2.configure(default_rlc_cnfg())) { + if (not rlc2.configure(rlc_config_t::default_rlc_am_config())) { return -1; } @@ -998,11 +985,11 @@ bool resegment_test_6() rlc_am rlc1(&log1, 1, &tester, &tester, &timers); rlc_am rlc2(&log2, 1, &tester, &tester, &timers); - if (not rlc1.configure(default_rlc_cnfg())) { + if (not rlc1.configure(rlc_config_t::default_rlc_am_config())) { return -1; } - if (not rlc2.configure(default_rlc_cnfg())) { + if (not rlc2.configure(rlc_config_t::default_rlc_am_config())) { return -1; } @@ -1134,11 +1121,11 @@ bool resegment_test_7() rlc_am rlc1(&log1, 1, &tester, &tester, &timers); rlc_am rlc2(&log2, 1, &tester, &tester, &timers); - if (not rlc1.configure(default_rlc_cnfg())) { + if (not rlc1.configure(rlc_config_t::default_rlc_am_config())) { return -1; } - if (not rlc2.configure(default_rlc_cnfg())) { + if (not rlc2.configure(rlc_config_t::default_rlc_am_config())) { return -1; } @@ -1307,11 +1294,11 @@ bool resegment_test_8() rlc_am rlc1(&log1, 1, &tester, &tester, &timers); rlc_am rlc2(&log2, 1, &tester, &tester, &timers); - if (not rlc1.configure(default_rlc_cnfg())) { + if (not rlc1.configure(rlc_config_t::default_rlc_am_config())) { return -1; } - if (not rlc2.configure(default_rlc_cnfg())) { + if (not rlc2.configure(rlc_config_t::default_rlc_am_config())) { return -1; } @@ -1451,7 +1438,7 @@ bool reset_test() rlc_am rlc1(&log1, 1, &tester, &tester, &timers); - if (not rlc1.configure(default_rlc_cnfg())) { + if (not rlc1.configure(rlc_config_t::default_rlc_am_config())) { return -1; } @@ -1496,7 +1483,7 @@ bool resume_test() rlc_am rlc1(&log1, 1, &tester, &tester, &timers); - if (not rlc1.configure(default_rlc_cnfg())) { + if (not rlc1.configure(rlc_config_t::default_rlc_am_config())) { return -1; } @@ -1540,7 +1527,7 @@ bool stop_test() rlc_am rlc1(&log1, 1, &tester, &tester, &timers); - if (not rlc1.configure(default_rlc_cnfg())) { + if (not rlc1.configure(rlc_config_t::default_rlc_am_config())) { return -1; } diff --git a/lib/test/upper/rlc_um_test.cc b/lib/test/upper/rlc_um_test.cc index 4730516eb..55d0abc74 100644 --- a/lib/test/upper/rlc_um_test.cc +++ b/lib/test/upper/rlc_um_test.cc @@ -94,28 +94,6 @@ public: uint32_t expected_sdu_len; }; -srslte::rlc_config_t make_rlc_cnfg_default(uint32_t sn) -{ - rlc_config_t cnfg; - cnfg.rlc_mode = rlc_mode_t::um; - cnfg.um.t_reordering = 5; - if (sn == 10) { - cnfg.um.rx_sn_field_length = rlc_umd_sn_size_t::size10bits; - cnfg.um.rx_window_size = 512; - cnfg.um.rx_mod = 1024; - cnfg.um.tx_sn_field_length = rlc_umd_sn_size_t::size10bits; - cnfg.um.tx_mod = 1024; - } else if (sn == 5) { - cnfg.um.rx_sn_field_length = rlc_umd_sn_size_t::size5bits; - cnfg.um.rx_window_size = 16; - cnfg.um.rx_mod = 32; - cnfg.um.tx_sn_field_length = rlc_umd_sn_size_t::size5bits; - cnfg.um.tx_mod = 32; - } else { - printf("NOT supported\n"); - } - return cnfg; -} int basic_test() { @@ -132,7 +110,7 @@ int basic_test() rlc_um rlc1(&log1, 3, &tester, &tester, &timers); rlc_um rlc2(&log2, 3, &tester, &tester, &timers); - rlc_config_t cnfg = make_rlc_cnfg_default(10); + rlc_config_t cnfg = rlc_config_t::default_rlc_um_config(10); cnfg.rlc_mode = rlc_mode_t::um; cnfg.um.t_reordering = 5; cnfg.um.rx_sn_field_length = rlc_umd_sn_size_t::size10bits; @@ -202,7 +180,7 @@ int loss_test() rlc_um rlc1(&log1, 3, &tester, &tester, &timers); rlc_um rlc2(&log2, 3, &tester, &tester, &timers); - rlc_config_t cnfg = make_rlc_cnfg_default(10); + rlc_config_t cnfg = rlc_config_t::default_rlc_um_config(10); rlc1.configure(cnfg); rlc2.configure(cnfg); @@ -335,7 +313,7 @@ int reassmble_test() rlc_um rlc1(&log1, 3, &tester, &tester, &timers); rlc_um rlc2(&log2, 3, &tester, &tester, &timers); - rlc_config_t cnfg = make_rlc_cnfg_default(5); + rlc_config_t cnfg = rlc_config_t::default_rlc_um_config(5); rlc1.configure(cnfg); rlc2.configure(cnfg); @@ -444,7 +422,7 @@ int reassmble_test2() rlc_um rlc1(&log1, 3, &tester, &tester, &timers); rlc_um rlc2(&log2, 3, &tester, &tester, &timers); - rlc_config_t cnfg = make_rlc_cnfg_default(5); + rlc_config_t cnfg = rlc_config_t::default_rlc_um_config(5); rlc1.configure(cnfg); rlc2.configure(cnfg);