From e7272fd2ae32c13ad089cc2ca0fecb97ba00a9d5 Mon Sep 17 00:00:00 2001 From: Ismael Date: Wed, 15 Mar 2023 10:17:28 +0100 Subject: [PATCH 1/6] rrc: set correct transaction id or security_mode_complete and reconfig_complete messages --- srsue/src/stack/rrc_nr/rrc_nr.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/srsue/src/stack/rrc_nr/rrc_nr.cc b/srsue/src/stack/rrc_nr/rrc_nr.cc index 868ddddb0..8f7ab358b 100644 --- a/srsue/src/stack/rrc_nr/rrc_nr.cc +++ b/srsue/src/stack/rrc_nr/rrc_nr.cc @@ -587,6 +587,7 @@ void rrc_nr::send_security_mode_complete() { ul_dcch_msg_s ul_dcch_msg; auto& smc = ul_dcch_msg.msg.set_c1().set_security_mode_complete().crit_exts.set_security_mode_complete(); + ul_dcch_msg.msg.c1().security_mode_complete().rrc_transaction_id = transaction_id; send_ul_dcch_msg(srb_to_lcid(nr_srb::srb1), ul_dcch_msg); } @@ -695,6 +696,7 @@ void rrc_nr::send_rrc_reconfig_complete() asn1::rrc_nr::ul_dcch_msg_s ul_dcch_msg; auto& rrc_reconfig_complete = ul_dcch_msg.msg.set_c1().set_rrc_recfg_complete().crit_exts.set_rrc_recfg_complete(); + ul_dcch_msg.msg.c1().rrc_recfg_complete().rrc_transaction_id = transaction_id; send_ul_dcch_msg(srb_to_lcid(nr_srb::srb1), ul_dcch_msg); } From 53eb21d745c6e0b551c6d266179470a04bb243ee Mon Sep 17 00:00:00 2001 From: Ismael Date: Wed, 15 Mar 2023 10:18:10 +0100 Subject: [PATCH 2/6] rrc: set default number of HARQ processes if option not present in serving_cell_cfg --- lib/src/asn1/rrc_nr_utils.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/src/asn1/rrc_nr_utils.cc b/lib/src/asn1/rrc_nr_utils.cc index 2eeba8f65..830cbb420 100644 --- a/lib/src/asn1/rrc_nr_utils.cc +++ b/lib/src/asn1/rrc_nr_utils.cc @@ -74,8 +74,7 @@ bool make_mac_dl_harq_cfg_nr_t(const pdsch_serving_cell_cfg_s& asn1_type, dl_har if (asn1_type.nrof_harq_processes_for_pdsch_present) { dl_harq_cfg_nr.nof_procs = asn1_type.nrof_harq_processes_for_pdsch.to_number(); } else { - asn1::log_warning("Option nrof_harq_processes_for_pdsch not present"); - return false; + dl_harq_cfg_nr.nof_procs = 8; } *out_dl_harq_cfg_nr = dl_harq_cfg_nr; return true; From 4d864e1e3b11c9a28e768ecc650b10457887b271 Mon Sep 17 00:00:00 2001 From: Pedro Alvarez Date: Thu, 16 Mar 2023 18:59:34 +0000 Subject: [PATCH 3/6] rlc: fix issue when t-StatusProhibit is configured to 0 --- lib/src/rlc/rlc_am_nr.cc | 14 +++++-- lib/test/rlc/rlc_am_nr_test.cc | 70 ++++++++++++++++++++++++++++++++++ 2 files changed, 80 insertions(+), 4 deletions(-) diff --git a/lib/src/rlc/rlc_am_nr.cc b/lib/src/rlc/rlc_am_nr.cc index a49b86a1d..9102b4260 100644 --- a/lib/src/rlc/rlc_am_nr.cc +++ b/lib/src/rlc/rlc_am_nr.cc @@ -33,7 +33,8 @@ const static uint32_t max_tx_queue_size = 256; ***************************************************************************/ rlc_am_nr_tx::rlc_am_nr_tx(rlc_am* parent_) : parent(parent_), rlc_am_base_tx(parent_->logger), poll_retransmit_timer(parent->timers->get_unique_timer()) -{} +{ +} bool rlc_am_nr_tx::configure(const rlc_config_t& cfg_) { @@ -1364,7 +1365,8 @@ rlc_am_nr_rx::rlc_am_nr_rx(rlc_am* parent_) : status_prohibit_timer(parent->timers->get_unique_timer()), reassembly_timer(parent->timers->get_unique_timer()), rlc_am_base_rx(parent_, parent_->logger) -{} +{ +} bool rlc_am_nr_rx::configure(const rlc_config_t& cfg_) { @@ -1814,7 +1816,7 @@ uint32_t rlc_am_nr_rx::get_status_pdu(rlc_am_nr_status_pdu_t* status, uint32_t m if (max_len != UINT32_MAX) { // UINT32_MAX is used just to query the status PDU length - if (status_prohibit_timer.is_valid()) { + if (status_prohibit_timer.is_valid() && cfg.t_status_prohibit != 0) { status_prohibit_timer.run(); } do_status = false; @@ -1832,7 +1834,11 @@ uint32_t rlc_am_nr_rx::get_status_pdu_length() bool rlc_am_nr_rx::get_do_status() { - return do_status.load(std::memory_order_relaxed) && not status_prohibit_timer.is_running(); + if (cfg.t_status_prohibit != 0) { + return do_status.load(std::memory_order_relaxed) && not status_prohibit_timer.is_running(); + } else { + return do_status.load(std::memory_order_relaxed); + } } void rlc_am_nr_rx::timer_expired(uint32_t timeout_id) diff --git a/lib/test/rlc/rlc_am_nr_test.cc b/lib/test/rlc/rlc_am_nr_test.cc index 81f31932a..dc86bd59f 100644 --- a/lib/test/rlc/rlc_am_nr_test.cc +++ b/lib/test/rlc/rlc_am_nr_test.cc @@ -3287,6 +3287,76 @@ int lost_status_and_advanced_rx_window(rlc_am_nr_sn_size_t sn_size) return SRSRAN_SUCCESS; } +// If we lose the status report +int do_status_0ms_status_prohibit(rlc_am_nr_sn_size_t sn_size) +{ + rlc_am_tester tester(true, nullptr); + timer_handler timers(8); + byte_buffer_t pdu_bufs[NBUFS]; + + auto& test_logger = srslog::fetch_basic_logger("TESTER "); + test_delimit_logger delimiter("Do status 0ms status prohibit ({} bit SN)", to_number(sn_size)); + rlc_am rlc1(srsran_rat_t::nr, srslog::fetch_basic_logger("RLC_AM_1"), 1, &tester, &tester, &timers); + rlc_am rlc2(srsran_rat_t::nr, srslog::fetch_basic_logger("RLC_AM_2"), 1, &tester, &tester, &timers); + + rlc_am_nr_tx* tx1 = dynamic_cast(rlc1.get_tx()); + rlc_am_nr_rx* rx1 = dynamic_cast(rlc1.get_rx()); + rlc_am_nr_tx* tx2 = dynamic_cast(rlc2.get_tx()); + rlc_am_nr_rx* rx2 = dynamic_cast(rlc2.get_rx()); + + auto cfg = rlc_config_t::default_rlc_am_nr_config(to_number(sn_size)); + cfg.am_nr.t_status_prohibit = 0; + if (not rlc1.configure(cfg)) { + return -1; + } + if (not rlc2.configure(cfg)) { + return -1; + } + uint32_t mod_nr = cardinality(cfg.am_nr.tx_sn_field_length); + + // Tx 5 PDUs + constexpr uint32_t payload_size = 3; // Give the SDU the size of 3 bytes + uint32_t header_size = sn_size == rlc_am_nr_sn_size_t::size12bits ? 2 : 3; + for (uint32_t sn = 0; sn < 5; ++sn) { + // Write SDU + unique_byte_buffer_t sdu_buf = srsran::make_byte_buffer(); + sdu_buf->msg[0] = sn; // Write the index into the buffer + sdu_buf->N_bytes = payload_size; // Give each buffer a size of 3 bytes + sdu_buf->md.pdcp_sn = sn; // PDCP SN for notifications + rlc1.write_sdu(std::move(sdu_buf)); + + // Read PDU + unique_byte_buffer_t pdu_buf = srsran::make_byte_buffer(); + pdu_buf->N_bytes = rlc1.read_pdu(pdu_buf->msg, 100); + + // Write PDU into RLC 2 + // We receive all PDUs + rlc2.write_pdu(pdu_buf->msg, pdu_buf->N_bytes); + } + + // Read status PDU + { + TESTASSERT_EQ(0, rlc1.get_buffer_state()); + unique_byte_buffer_t status_buf = srsran::make_byte_buffer(); + status_buf->N_bytes = rlc2.read_pdu(status_buf->msg, 1000); + } + + // Let timers run for t-PollRetransmit expire + { + for (int cnt = 0; cnt < 45; cnt++) { + timers.step_all(); + } + TESTASSERT_EQ(header_size + payload_size, rlc1.get_buffer_state()); + TESTASSERT_EQ(0, rlc2.get_buffer_state()); + unique_byte_buffer_t poll_buf = srsran::make_byte_buffer(); + poll_buf->N_bytes = rlc1.read_pdu(poll_buf->msg, 1000); + rlc2.write_pdu(poll_buf->msg, poll_buf->N_bytes); + TESTASSERT_NEQ(0, rlc2.get_buffer_state()); + } + + return SRSRAN_SUCCESS; +} + int full_rx_window_t_reassembly_expiry(rlc_am_nr_sn_size_t sn_size) { rlc_am_tester tester(false, nullptr); From 894b449fca16a6cd5848bd024389577c13b5b13b Mon Sep 17 00:00:00 2001 From: Piotr Date: Wed, 5 Apr 2023 08:45:01 +0200 Subject: [PATCH 4/6] io: use proper pointer type in filesink (#4105) --- lib/src/phy/io/filesink.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/src/phy/io/filesink.c b/lib/src/phy/io/filesink.c index d7f95a704..fedfe7796 100644 --- a/lib/src/phy/io/filesink.c +++ b/lib/src/phy/io/filesink.c @@ -132,7 +132,13 @@ int srsran_filesink_write_multi(srsran_filesink_t* q, void** buffer, int nsample uint32_t count = 0; for (i = 0; i < nsamples; i++) { for (j = 0; j < nchannels; j++) { - count += fwrite(&cbuf[j][i], size, 1, q->f); + if (q->type == SRSRAN_FLOAT_BIN) { + count += fwrite(&fbuf[j][i], size, 1, q->f); + } else if (q->type == SRSRAN_COMPLEX_FLOAT_BIN) { + count += fwrite(&cbuf[j][i], size, 1, q->f); + } else if (q->type == SRSRAN_COMPLEX_SHORT_BIN) { + count += fwrite(&sbuf[j][i], size, 1, q->f); + } } } return count; From 1acf19c8b19f445ed01e654a35671120c1066d17 Mon Sep 17 00:00:00 2001 From: yagoda Date: Mon, 3 Apr 2023 15:31:50 +0200 Subject: [PATCH 5/6] eMBMS: adding mrb lcid checks to sdu_queue_is_full and rb_is_um functions in RLC. --- lib/src/rlc/rlc.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/src/rlc/rlc.cc b/lib/src/rlc/rlc.cc index 60186068b..638cc76cc 100644 --- a/lib/src/rlc/rlc.cc +++ b/lib/src/rlc/rlc.cc @@ -204,6 +204,8 @@ bool rlc::rb_is_um(uint32_t lcid) if (valid_lcid(lcid)) { ret = rlc_array.at(lcid)->get_mode() == rlc_mode_t::um; + } else if (valid_lcid_mrb(lcid)) { + ret = rlc_array_mrb.at(lcid)->get_mode() == rlc_mode_t::um; } else { logger.warning("LCID %d doesn't exist.", lcid); } @@ -225,6 +227,8 @@ bool rlc::sdu_queue_is_full(uint32_t lcid) { if (valid_lcid(lcid)) { return rlc_array.at(lcid)->sdu_queue_is_full(); + } else if (valid_lcid_mrb(lcid)) { + return rlc_array_mrb.at(lcid)->sdu_queue_is_full(); } logger.warning("RLC LCID %d doesn't exist. Ignoring queue check", lcid); return false; From 637e7ce9fa9fb84ae6b1ee20a03e86b3772c90b5 Mon Sep 17 00:00:00 2001 From: yagoda Date: Mon, 3 Apr 2023 15:33:21 +0200 Subject: [PATCH 6/6] eMBMS: removing duplicate sib13 functions from RRC --- lib/src/rlc/rlc.cc | 2 +- srsue/hdr/stack/rrc/rrc_cell.h | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/lib/src/rlc/rlc.cc b/lib/src/rlc/rlc.cc index 638cc76cc..bbad52a52 100644 --- a/lib/src/rlc/rlc.cc +++ b/lib/src/rlc/rlc.cc @@ -474,7 +474,7 @@ int rlc::add_bearer_mrb(uint32_t lcid) } logger.info("Added bearer MRB%d with mode RLC_UM", lcid); } else { - logger.warning("Bearer MRB%d already created.", lcid); + logger.info("Bearer MRB%d already created.", lcid); } return SRSRAN_SUCCESS; diff --git a/srsue/hdr/stack/rrc/rrc_cell.h b/srsue/hdr/stack/rrc/rrc_cell.h index d28a45f76..3999f4602 100644 --- a/srsue/hdr/stack/rrc/rrc_cell.h +++ b/srsue/hdr/stack/rrc/rrc_cell.h @@ -158,8 +158,6 @@ public: uint32_t get_cell_id() const { return (uint32_t)sib1.cell_access_related_info.cell_id.to_number(); } asn1::fixed_bitstring<28> get_cell_id_bit() const { return sib1.cell_access_related_info.cell_id; } - bool has_sib13() const { return has_valid_sib13; } - uint16_t get_mcc() const; uint16_t get_mnc() const; @@ -173,7 +171,6 @@ public: asn1::rrc::mcch_msg_s mcch = {}; private: - bool has_valid_sib13 = false; }; //! Universal methods to extract pci/earfcn and compare the two values