diff --git a/srsenb/hdr/stack/mac/nr/sched_nr.h b/srsenb/hdr/stack/mac/nr/sched_nr.h index 9ed0debd5..6249dd9c1 100644 --- a/srsenb/hdr/stack/mac/nr/sched_nr.h +++ b/srsenb/hdr/stack/mac/nr/sched_nr.h @@ -47,7 +47,7 @@ public: void dl_ack_info(uint16_t rnti, uint32_t cc, uint32_t pid, uint32_t tb_idx, bool ack) override; void ul_crc_info(uint16_t rnti, uint32_t cc, uint32_t pid, bool crc) override; - void ul_sr_info(slot_point slot_rx, uint16_t rnti) override; + void ul_sr_info(uint16_t rnti) override; void ul_bsr(uint16_t rnti, uint32_t lcg_id, uint32_t bsr) override; void dl_buffer_state(uint16_t rnti, uint32_t lcid, uint32_t newtx, uint32_t retx); diff --git a/srsenb/hdr/stack/mac/nr/sched_nr_interface.h b/srsenb/hdr/stack/mac/nr/sched_nr_interface.h index 700ba7942..fa9e30e26 100644 --- a/srsenb/hdr/stack/mac/nr/sched_nr_interface.h +++ b/srsenb/hdr/stack/mac/nr/sched_nr_interface.h @@ -125,7 +125,7 @@ public: virtual void dl_ack_info(uint16_t rnti, uint32_t cc, uint32_t pid, uint32_t tb_idx, bool ack) = 0; virtual void ul_crc_info(uint16_t rnti, uint32_t cc, uint32_t pid, bool crc) = 0; - virtual void ul_sr_info(slot_point, uint16_t rnti) = 0; + virtual void ul_sr_info(uint16_t rnti) = 0; virtual void ul_bsr(uint16_t rnti, uint32_t lcg_id, uint32_t bsr) = 0; }; diff --git a/srsenb/hdr/stack/mac/nr/sched_nr_ue.h b/srsenb/hdr/stack/mac/nr/sched_nr_ue.h index ca9937e9c..3887e23ff 100644 --- a/srsenb/hdr/stack/mac/nr/sched_nr_ue.h +++ b/srsenb/hdr/stack/mac/nr/sched_nr_ue.h @@ -92,7 +92,7 @@ public: void rlc_buffer_state(uint32_t lcid, uint32_t newtx, uint32_t retx) { buffers.dl_buffer_state(lcid, newtx, retx); } void ul_bsr(uint32_t lcg, uint32_t bsr_val) { buffers.ul_bsr(lcg, bsr_val); } - void ul_sr_info(slot_point slot_rx) { last_sr_slot = slot_rx; } + void ul_sr_info() { last_sr_slot = last_pdcch_slot - TX_ENB_DELAY; } bool has_ca() const { @@ -109,6 +109,7 @@ private: const uint16_t rnti; const sched_params& sched_cfg; + slot_point last_pdcch_slot; slot_point last_sr_slot; int ul_pending_bytes = 0, dl_pending_bytes = 0; diff --git a/srsenb/src/stack/mac/nr/mac_nr.cc b/srsenb/src/stack/mac/nr/mac_nr.cc index 017e45f19..62e68301b 100644 --- a/srsenb/src/stack/mac/nr/mac_nr.cc +++ b/srsenb/src/stack/mac/nr/mac_nr.cc @@ -342,7 +342,7 @@ bool mac_nr::handle_uci_data(const uint16_t rnti, const srsran_uci_cfg_nr_t& cfg // Process SR if (value.valid and value.sr > 0) { - sched.ul_sr_info(pdsch_slot - TX_ENB_DELAY, cfg_.pucch.rnti); + sched.ul_sr_info(cfg_.pucch.rnti); } return true; } diff --git a/srsenb/src/stack/mac/nr/sched_nr.cc b/srsenb/src/stack/mac/nr/sched_nr.cc index b2c503f07..65df395e4 100644 --- a/srsenb/src/stack/mac/nr/sched_nr.cc +++ b/srsenb/src/stack/mac/nr/sched_nr.cc @@ -163,9 +163,9 @@ void sched_nr::ul_crc_info(uint16_t rnti, uint32_t cc, uint32_t pid, bool crc) sched_workers->enqueue_cc_feedback(rnti, cc, [pid, crc](ue_carrier& ue_cc) { ue_cc.harq_ent.ul_crc_info(pid, crc); }); } -void sched_nr::ul_sr_info(slot_point slot_rx, uint16_t rnti) +void sched_nr::ul_sr_info(uint16_t rnti) { - sched_workers->enqueue_event(rnti, [this, rnti, slot_rx]() { ue_db[rnti]->ul_sr_info(slot_rx); }); + sched_workers->enqueue_event(rnti, [this, rnti]() { ue_db[rnti]->ul_sr_info(); }); } void sched_nr::ul_bsr(uint16_t rnti, uint32_t lcg_id, uint32_t bsr) diff --git a/srsenb/src/stack/mac/nr/sched_nr_ue.cc b/srsenb/src/stack/mac/nr/sched_nr_ue.cc index a3bee7584..5f9156db3 100644 --- a/srsenb/src/stack/mac/nr/sched_nr_ue.cc +++ b/srsenb/src/stack/mac/nr/sched_nr_ue.cc @@ -100,6 +100,8 @@ void ue::set_cfg(const ue_cfg_t& cfg) void ue::new_slot(slot_point pdcch_slot) { + last_pdcch_slot = pdcch_slot; + for (auto& ue_cc_cfg : ue_cfg.carriers) { auto& cc = carriers[ue_cc_cfg.cc]; if (cc != nullptr) { diff --git a/srsenb/src/stack/mac/nr/ue_nr.cc b/srsenb/src/stack/mac/nr/ue_nr.cc index ae45ba81d..75e89061d 100644 --- a/srsenb/src/stack/mac/nr/ue_nr.cc +++ b/srsenb/src/stack/mac/nr/ue_nr.cc @@ -68,7 +68,7 @@ int ue_nr::process_pdu(srsran::unique_byte_buffer_t pdu) if (logger.info.enabled()) { fmt::memory_buffer str_buffer; mac_pdu_ul.to_string(str_buffer); - logger.info("0x%x %s", rnti, srsran::to_c_str(str_buffer)); + logger.info("Rx PDU: rnti=0x%x, %s", rnti, srsran::to_c_str(str_buffer)); } for (uint32_t i = 0; i < mac_pdu_ul.get_num_subpdus(); ++i) { @@ -86,7 +86,7 @@ int ue_nr::process_pdu(srsran::unique_byte_buffer_t pdu) if (true /*sched->ue_exists(c_crnti)*/) { rrc->update_user(rnti, c_rnti); rnti = c_rnti; - sched->ul_bsr(rnti, 0, 1); // provide UL grant regardless of other BSR content for UE to complete RA + sched->ul_sr_info(rnti); // provide UL grant regardless of other BSR content for UE to complete RA } else { logger.warning("Updating user C-RNTI: rnti=0x%x already released.", c_rnti); // Disable scheduling for all bearers. The new rnti will be removed on msg3 timer expiry in the RRC @@ -99,10 +99,6 @@ int ue_nr::process_pdu(srsran::unique_byte_buffer_t pdu) case srsran::mac_sch_subpdu_nr::nr_lcid_sch_t::SHORT_TRUNC_BSR: { srsran::mac_sch_subpdu_nr::lcg_bsr_t sbsr = subpdu.get_sbsr(); uint32_t buffer_size_bytes = buff_size_field_to_bytes(sbsr.buffer_size, srsran::SHORT_BSR); - // FIXME: a UE might send a zero BSR but still needs an UL grant to finish RA procedure - if (buffer_size_bytes == 0) { - buffer_size_bytes++; - } sched->ul_bsr(rnti, sbsr.lcg_id, buffer_size_bytes); } break; case srsran::mac_sch_subpdu_nr::nr_lcid_sch_t::LONG_BSR: @@ -172,8 +168,8 @@ void ue_nr::metrics_read(mac_ue_metrics_t* metrics_) // set PCell sector id std::array cc_list; //= sched->get_enb_ue_cc_map(rnti); - auto it = std::find(cc_list.begin(), cc_list.end(), 0); - ue_metrics.cc_idx = std::distance(cc_list.begin(), it); + auto it = std::find(cc_list.begin(), cc_list.end(), 0); + ue_metrics.cc_idx = std::distance(cc_list.begin(), it); *metrics_ = ue_metrics; diff --git a/srsenb/src/stack/rrc/rrc_mobility.cc b/srsenb/src/stack/rrc/rrc_mobility.cc index fa71726e8..9c2ca8fe9 100644 --- a/srsenb/src/stack/rrc/rrc_mobility.cc +++ b/srsenb/src/stack/rrc/rrc_mobility.cc @@ -239,7 +239,6 @@ void rrc::ue::rrc_mobility::handle_ue_meas_report(const meas_report_s& msg, srsr } if (meas_res.meas_result_neigh_cells.type().value != meas_results_s::meas_result_neigh_cells_c_::types::meas_result_list_eutra) { - Error("MeasReports regarding non-EUTRA are not supported!"); return; } const meas_id_list& measid_list = rrc_ue->current_ue_cfg.meas_cfg.meas_id_to_add_mod_list; @@ -861,11 +860,11 @@ void rrc::ue::rrc_mobility::handle_ho_requested(idle_st& s, const ho_req_rx_ev& if (ho_req.transparent_container->erab_info_list_present) { const auto& lst = ho_req.transparent_container->erab_info_list; const auto* it = std::find_if( - lst.begin(), - lst.end(), - [&erab](const asn1::s1ap::protocol_ie_single_container_s& fwd_erab) { + lst.begin(), + lst.end(), + [&erab](const asn1::s1ap::protocol_ie_single_container_s& fwd_erab) { return fwd_erab.value.erab_info_list_item().erab_id == erab.second.id; - }); + }); if (it == lst.end()) { continue; } @@ -1044,7 +1043,7 @@ void rrc::ue::rrc_mobility::handle_status_transfer(s1_target_ho_st& s, const sta const auto& drbs = rrc_ue->bearer_list.get_established_drbs(); lte_drb drbid = lte_lcid_to_drb(erab_it->second.lcid); auto drb_it = std::find_if( - drbs.begin(), drbs.end(), [drbid](const drb_to_add_mod_s& drb) { return (lte_drb)drb.drb_id == drbid; }); + drbs.begin(), drbs.end(), [drbid](const drb_to_add_mod_s& drb) { return (lte_drb)drb.drb_id == drbid; }); if (drb_it == drbs.end()) { logger.warning("The DRB id=%d does not exist", drbid); }