@@ -33,14 +33,24 @@ namespace {
3333class downlink_processor_dummy : public downlink_processor
3434{
3535public:
36- void process_pdcch (const pdcch_processor::pdu_t & pdu) override {}
36+ void process_pdcch (const pdcch_processor::pdu_t & pdu) override
37+ {
38+ srslog::fetch_basic_logger (" FAPI" ).warning (" Could not enqueue PDCCH PDU in the downlink processor" );
39+ }
3740 void process_pdsch (unique_tx_buffer softbuffer,
3841 const static_vector<span<const uint8_t >, pdsch_processor::MAX_NOF_TRANSPORT_BLOCKS>& data,
3942 const pdsch_processor::pdu_t & pdu) override
4043 {
44+ srslog::fetch_basic_logger (" FAPI" ).warning (" Could not enqueue PDSCH PDU in the downlink processor" );
45+ }
46+ void process_ssb (const ssb_processor::pdu_t & pdu) override
47+ {
48+ srslog::fetch_basic_logger (" FAPI" ).warning (" Could not enqueue SSB PDU in the downlink processor" );
49+ }
50+ void process_nzp_csi_rs (const nzp_csi_rs_generator::config_t & config) override
51+ {
52+ srslog::fetch_basic_logger (" FAPI" ).warning (" Could not enqueue NZP-CSI-RS PDU in the downlink processor" );
4153 }
42- void process_ssb (const ssb_processor::pdu_t & pdu) override {}
43- void process_nzp_csi_rs (const nzp_csi_rs_generator::config_t & config) override {}
4454 bool configure_resource_grid (const resource_grid_context& context, resource_grid& grid) override { return true ; }
4555 void finish_processing_pdus () override {}
4656};
@@ -270,9 +280,13 @@ void fapi_to_phy_translator::dl_tti_request(const fapi::dl_tti_request_message&
270280{
271281 // :TODO: check the current slot matches the DL_TTI.request slot. Do this in a different class.
272282 // :TODO: check the messages order. Do this in a different class.
273- std::lock_guard<std::mutex> lock (mutex);
274-
275283 slot_point slot (scs, msg.sfn , msg.slot );
284+ slot_point current_slot = get_current_slot ();
285+
286+ if (!pdsch_repository.empty ()) {
287+ logger.warning (
288+ " Could not process '{}' PDSCH PDUs from the slot '{}'" , pdsch_repository.pdus .size (), pdsch_repository.slot );
289+ }
276290
277291 // Reset the repository.
278292 pdsch_repository.reset (slot);
@@ -428,9 +442,11 @@ static expected<uplink_pdus> translate_ul_tti_pdus_to_phy_pdus(const fapi::ul_tt
428442void fapi_to_phy_translator::ul_tti_request (const fapi::ul_tti_request_message& msg)
429443{
430444 // :TODO: check the messages order. Do this in a different class.
431- std::lock_guard<std::mutex> lock (mutex);
432-
433445 slot_point slot (scs, msg.sfn , msg.slot );
446+ slot_point current_slot = get_current_slot ();
447+
448+ // Clear the repository for the message slot.
449+ ul_pdu_repository.clear_slot (slot);
434450
435451 // Release the controller of the previous slot in case that it has not been released before. In case that it already
436452 // is released, this call will do nothing.
@@ -488,7 +504,7 @@ void fapi_to_phy_translator::ul_tti_request(const fapi::ul_tti_request_message&
488504
489505void fapi_to_phy_translator::ul_dci_request (const fapi::ul_dci_request_message& msg)
490506{
491- std::lock_guard<std::mutex> lock (mutex );
507+ slot_point current_slot = get_current_slot ( );
492508
493509 // Ignore messages that do not correspond to the current slot.
494510 if (!is_message_in_time (msg)) {
@@ -535,7 +551,7 @@ void fapi_to_phy_translator::ul_dci_request(const fapi::ul_dci_request_message&
535551
536552void fapi_to_phy_translator::tx_data_request (const fapi::tx_data_request_message& msg)
537553{
538- std::lock_guard<std::mutex> lock (mutex );
554+ slot_point current_slot = get_current_slot ( );
539555
540556 // Ignore messages that do not correspond to the current slot.
541557 if (!is_message_in_time (msg)) {
@@ -544,6 +560,9 @@ void fapi_to_phy_translator::tx_data_request(const fapi::tx_data_request_message
544560 error_notifier.get ().on_error_indication (fapi::build_invalid_sfn_error_indication (
545561 msg.sfn , msg.slot , fapi::message_type_id::tx_data_request, current_slot.sfn (), current_slot.slot_index ()));
546562 l2_tracer << instant_trace_event{" tx_data_req_late" , instant_trace_event::cpu_scope::global};
563+
564+ pdsch_repository.clear ();
565+
547566 return ;
548567 }
549568
@@ -553,6 +572,9 @@ void fapi_to_phy_translator::tx_data_request(const fapi::tx_data_request_message
553572 pdsch_repository.pdus .size ());
554573 // Raise invalid format error.
555574 error_notifier.get ().on_error_indication (fapi::build_msg_tx_error_indication (msg.sfn , msg.slot ));
575+
576+ pdsch_repository.clear ();
577+
556578 return ;
557579 }
558580
@@ -611,15 +633,18 @@ void fapi_to_phy_translator::tx_data_request(const fapi::tx_data_request_message
611633 }
612634
613635 slot_controller_mngr.release_controller (slot);
636+
637+ // All the PDSCH PDUs have been processed. Clear the repository.
638+ pdsch_repository.clear ();
614639}
615640
616641void fapi_to_phy_translator::handle_new_slot (slot_point slot)
617642{
618- std::lock_guard<std::mutex> lock (mutex);
643+ // Update the atomic variable that holds the slot point.
644+ current_slot_count_val.store (slot.system_slot (), std::memory_order_release);
619645
620- current_slot = slot;
646+ // Release old controllers.
621647 slot_controller_mngr.handle_new_slot (slot);
622- ul_pdu_repository.clear_slot (slot);
623648
624649 // Enqueue soft buffer run slot.
625650 if (!asynchronous_executor.execute ([this , slot]() { buffer_pool.run_slot (slot); })) {
@@ -634,6 +659,7 @@ template <typename T>
634659bool fapi_to_phy_translator::is_message_in_time (const T& msg) const
635660{
636661 slot_point msg_slot (scs, msg.sfn , msg.slot );
662+ slot_point current_slot = get_current_slot ();
637663 slot_point last_allowed_message = current_slot - int (nof_slots_request_headroom);
638664
639665 return last_allowed_message <= msg_slot && msg_slot <= current_slot;
@@ -647,7 +673,7 @@ fapi_to_phy_translator::slot_based_upper_phy_controller_manager::get_controller(
647673
648674void fapi_to_phy_translator::slot_based_upper_phy_controller_manager::handle_new_slot (slot_point slot)
649675{
650- // Remove the oldest controller.
676+ // Release the oldest controller.
651677 slot_point oldest_slot = slot - int (controllers.size () - 1 );
652678 controller (oldest_slot) = slot_based_upper_phy_controller ();
653679}
@@ -673,7 +699,13 @@ fapi_to_phy_translator::slot_based_upper_phy_controller_manager::slot_based_uppe
673699 dl_processor_pool(dl_processor_pool_),
674700 rg_pool(rg_pool_),
675701 sector_id(sector_id_),
676- // The manager should be able to manage the current slot plus the requests headroom size.
677- controllers(nof_slots_request_headroom + 1U )
702+ // The manager should be able to manage the current slot plus the requests headroom size. Also, as it should clean the
703+ // oldest slot when a new SLOT.indication is received, it should have two extra positions for these oldest slots.
704+ // Adding two extra positions makes that if a new SLOT.indication arrives in the middle of a valid processing PDU, the
705+ // controller for that slot will not be released in the middle of processing the messages.
706+ // NOTE: if we can ensure that no messages will be lost, we can remove this extra positions in the manager, as it
707+ // would not be required to release controllers when the slot changes, Also, this would be valid when the time when a
708+ // controller is released does not matter for incomplete/lost messages.
709+ controllers(nof_slots_request_headroom + 3U )
678710{
679711}
0 commit comments