diff --git a/lib/src/asn1/rrc_nr_utils.cc b/lib/src/asn1/rrc_nr_utils.cc index cbbd66360..ddf17e084 100644 --- a/lib/src/asn1/rrc_nr_utils.cc +++ b/lib/src/asn1/rrc_nr_utils.cc @@ -83,8 +83,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; diff --git a/lib/src/phy/io/filesink.c b/lib/src/phy/io/filesink.c index f53b47cb4..83f75f719 100644 --- a/lib/src/phy/io/filesink.c +++ b/lib/src/phy/io/filesink.c @@ -141,7 +141,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; diff --git a/lib/src/rlc/rlc.cc b/lib/src/rlc/rlc.cc index fdbb8d86a..7b0be31ed 100644 --- a/lib/src/rlc/rlc.cc +++ b/lib/src/rlc/rlc.cc @@ -213,6 +213,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); } @@ -234,6 +236,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; @@ -479,7 +483,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/lib/src/rlc/rlc_am_nr.cc b/lib/src/rlc/rlc_am_nr.cc index c38e90c58..26df732a8 100644 --- a/lib/src/rlc/rlc_am_nr.cc +++ b/lib/src/rlc/rlc_am_nr.cc @@ -42,7 +42,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_) { @@ -1373,7 +1374,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_) { @@ -1823,7 +1825,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; @@ -1841,7 +1843,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 413cb552c..03098f4ad 100644 --- a/lib/test/rlc/rlc_am_nr_test.cc +++ b/lib/test/rlc/rlc_am_nr_test.cc @@ -3296,6 +3296,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); diff --git a/srsue/hdr/stack/rrc/rrc_cell.h b/srsue/hdr/stack/rrc/rrc_cell.h index 9de51c782..8e6525760 100644 --- a/srsue/hdr/stack/rrc/rrc_cell.h +++ b/srsue/hdr/stack/rrc/rrc_cell.h @@ -167,8 +167,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; @@ -182,7 +180,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 diff --git a/srsue/src/stack/rrc_nr/rrc_nr.cc b/srsue/src/stack/rrc_nr/rrc_nr.cc index 7c5f393c0..79e783db0 100644 --- a/srsue/src/stack/rrc_nr/rrc_nr.cc +++ b/srsue/src/stack/rrc_nr/rrc_nr.cc @@ -596,6 +596,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); } @@ -704,6 +705,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); }