renamed interfaces

master
Francisco Paisana 5 years ago
parent 1a9c04bf2f
commit 039977aeb5

@ -91,13 +91,12 @@ public:
class task_handler_interface class task_handler_interface
{ {
public: public:
virtual srslte::timer_handler::unique_timer get_unique_timer() = 0; virtual srslte::timer_handler::unique_timer get_unique_timer() = 0;
virtual srslte::task_multiqueue::queue_handler make_task_queue() = 0; virtual srslte::task_multiqueue::queue_handle make_task_queue() = 0;
virtual srslte::task_multiqueue::queue_handler make_task_queue(uint32_t queue_size) = 0; virtual void defer_callback(uint32_t duration_ms, std::function<void()> func) = 0;
virtual void defer_callback(uint32_t duration_ms, std::function<void()> func) = 0; virtual void defer_task(srslte::move_task_t func) = 0;
virtual void defer_task(srslte::move_task_t func) = 0; virtual void enqueue_background_task(std::function<void(uint32_t)> task) = 0;
virtual void enqueue_background_task(std::function<void(uint32_t)> task) = 0; virtual void notify_background_task_result(srslte::move_task_t task) = 0;
virtual void notify_background_task_result(srslte::move_task_t task) = 0;
}; };
class stack_interface_phy_nr class stack_interface_phy_nr

@ -90,11 +90,11 @@ class multiqueue_handler
}; };
public: public:
class queue_handler class queue_handle
{ {
public: public:
queue_handler() = default; queue_handle() = default;
queue_handler(multiqueue_handler<myobj>* parent_, int id) : parent(parent_), queue_id(id) {} queue_handle(multiqueue_handler<myobj>* parent_, int id) : parent(parent_), queue_id(id) {}
template <typename FwdRef> template <typename FwdRef>
void push(FwdRef&& value) void push(FwdRef&& value)
{ {
@ -293,8 +293,8 @@ public:
return is_queue_active_(qidx); return is_queue_active_(qidx);
} }
queue_handler get_queue_handler() { return {this, add_queue()}; } queue_handle get_queue_handler() { return {this, add_queue()}; }
queue_handler get_queue_handler(uint32_t size) { return {this, add_queue(size)}; } queue_handle get_queue_handler(uint32_t size) { return {this, add_queue(size)}; }
private: private:
bool is_queue_active_(int qidx) const { return running and queues[qidx].active; } bool is_queue_active_(int qidx) const { return running and queues[qidx].active; }
@ -325,7 +325,8 @@ private:
}; };
//! Specialization for tasks //! Specialization for tasks
using task_multiqueue = multiqueue_handler<move_task_t>; using task_multiqueue = multiqueue_handler<move_task_t>;
using task_queue_handle = task_multiqueue::queue_handle;
} // namespace srslte } // namespace srslte

@ -52,14 +52,11 @@ public:
external_tasks.reset(); external_tasks.reset();
} }
srslte::timer_handler::unique_timer get_unique_timer() final { return timers.get_unique_timer(); } srslte::unique_timer get_unique_timer() final { return timers.get_unique_timer(); }
//! Creates new queue for tasks coming from external thread //! Creates new queue for tasks coming from external thread
srslte::task_multiqueue::queue_handler make_task_queue() final { return external_tasks.get_queue_handler(); } srslte::task_queue_handle make_task_queue() final { return external_tasks.get_queue_handler(); }
srslte::task_multiqueue::queue_handler make_task_queue(uint32_t size) final srslte::task_queue_handle make_task_queue(uint32_t qsize) { return external_tasks.get_queue_handler(qsize); }
{
return external_tasks.get_queue_handler(size);
}
//! Delays a task processing by duration_ms //! Delays a task processing by duration_ms
void defer_callback(uint32_t duration_ms, std::function<void()> func) final void defer_callback(uint32_t duration_ms, std::function<void()> func) final
@ -140,13 +137,13 @@ private:
std::vector<srslte::move_task_t> internal_tasks; ///< enqueues stack tasks from within main thread. Avoids locking std::vector<srslte::move_task_t> internal_tasks; ///< enqueues stack tasks from within main thread. Avoids locking
}; };
//! Handle to provide to classes/functions running within main thread //! Task scheduler handle given to classes/functions running within the main control thread
class task_sched_handle class task_sched_handle
{ {
public: public:
task_sched_handle(task_scheduler* sched_) : sched(sched_) {} task_sched_handle(task_scheduler* sched_) : sched(sched_) {}
srslte::timer_handler::unique_timer get_unique_timer() { return sched->get_unique_timer(); } srslte::unique_timer get_unique_timer() { return sched->get_unique_timer(); }
void enqueue_background_task(std::function<void(uint32_t)> f) { sched->enqueue_background_task(std::move(f)); } void enqueue_background_task(std::function<void(uint32_t)> f) { sched->enqueue_background_task(std::move(f)); }
void notify_background_task_result(srslte::move_task_t task) void notify_background_task_result(srslte::move_task_t task)
{ {

@ -330,6 +330,8 @@ private:
std::mutex mutex; // Protect priority queue std::mutex mutex; // Protect priority queue
}; };
using unique_timer = timer_handler::unique_timer;
} // namespace srslte } // namespace srslte
#endif // SRSLTE_TIMERS_H #endif // SRSLTE_TIMERS_H

@ -39,11 +39,10 @@ public:
{ {
return srslte::tti_point{task_sched.get_timer_handler()->get_cur_time() % 10240}; return srslte::tti_point{task_sched.get_timer_handler()->get_cur_time() % 10240};
} }
srslte::task_multiqueue::queue_handler make_task_queue() final { return task_sched.make_task_queue(); } srslte::task_multiqueue::queue_handle make_task_queue() final { return task_sched.make_task_queue(); }
srslte::task_multiqueue::queue_handler make_task_queue(uint32_t len) final { return task_sched.make_task_queue(len); } void enqueue_background_task(std::function<void(uint32_t)> f) override { f(0); }
void enqueue_background_task(std::function<void(uint32_t)> f) override { f(0); } void notify_background_task_result(srslte::move_task_t task) override { task(); }
void notify_background_task_result(srslte::move_task_t task) override { task(); } void defer_callback(uint32_t duration_ms, std::function<void()> func) final
void defer_callback(uint32_t duration_ms, std::function<void()> func) final
{ {
task_sched.defer_callback(duration_ms, std::move(func)); task_sched.defer_callback(duration_ms, std::move(func));
} }

@ -110,13 +110,12 @@ public:
void add_gtpu_m1u_socket_handler(int fd) override; void add_gtpu_m1u_socket_handler(int fd) override;
/* Stack-MAC interface */ /* Stack-MAC interface */
srslte::timer_handler::unique_timer get_unique_timer() final; srslte::unique_timer get_unique_timer() final;
srslte::task_multiqueue::queue_handler make_task_queue() final; srslte::task_queue_handle make_task_queue() final;
srslte::task_multiqueue::queue_handler make_task_queue(uint32_t qsize) final; void defer_callback(uint32_t duration_ms, std::function<void()> func) final;
void defer_callback(uint32_t duration_ms, std::function<void()> func) final; void enqueue_background_task(std::function<void(uint32_t)> task) final;
void enqueue_background_task(std::function<void(uint32_t)> task) final; void notify_background_task_result(srslte::move_task_t task) final;
void notify_background_task_result(srslte::move_task_t task) final; void defer_task(srslte::move_task_t task) final;
void defer_task(srslte::move_task_t task) final;
private: private:
static const int STACK_MAIN_THREAD_PRIO = 4; static const int STACK_MAIN_THREAD_PRIO = 4;
@ -134,8 +133,8 @@ private:
rrc_cfg_t rrc_cfg = {}; rrc_cfg_t rrc_cfg = {};
// task handling // task handling
srslte::task_scheduler task_sched; srslte::task_scheduler task_sched;
srslte::task_multiqueue::queue_handler enb_task_queue, gtpu_task_queue, mme_task_queue, sync_task_queue; srslte::task_queue_handle enb_task_queue, gtpu_task_queue, mme_task_queue, sync_task_queue;
// components that layers depend on (need to be destroyed after layers) // components that layers depend on (need to be destroyed after layers)
std::unique_ptr<srslte::rx_multisocket_handler> rx_sockets; std::unique_ptr<srslte::rx_multisocket_handler> rx_sockets;

@ -80,16 +80,12 @@ public:
void process_pdus() final; void process_pdus() final;
// Task Handling interface // Task Handling interface
srslte::timer_handler::unique_timer get_unique_timer() final { return task_sched.get_unique_timer(); } srslte::timer_handler::unique_timer get_unique_timer() final { return task_sched.get_unique_timer(); }
srslte::task_multiqueue::queue_handler make_task_queue() final { return task_sched.make_task_queue(); } srslte::task_multiqueue::queue_handle make_task_queue() final { return task_sched.make_task_queue(); }
srslte::task_multiqueue::queue_handler make_task_queue(uint32_t qsize) final void enqueue_background_task(std::function<void(uint32_t)> f) final;
{ void notify_background_task_result(srslte::move_task_t task) final;
return task_sched.make_task_queue(qsize); void defer_callback(uint32_t duration_ms, std::function<void()> func) final;
} void defer_task(srslte::move_task_t task) final;
void enqueue_background_task(std::function<void(uint32_t)> f) final;
void notify_background_task_result(srslte::move_task_t task) final;
void defer_callback(uint32_t duration_ms, std::function<void()> func) final;
void defer_task(srslte::move_task_t task) final;
private: private:
void run_thread() final; void run_thread() final;
@ -101,9 +97,9 @@ private:
phy_interface_stack_nr* phy = nullptr; phy_interface_stack_nr* phy = nullptr;
// task scheduling // task scheduling
static const int STACK_MAIN_THREAD_PRIO = 4; static const int STACK_MAIN_THREAD_PRIO = 4;
srslte::task_scheduler task_sched; srslte::task_scheduler task_sched;
srslte::task_multiqueue::queue_handler sync_task_queue, ue_task_queue, gw_task_queue, mac_task_queue; srslte::task_multiqueue::queue_handle sync_task_queue, ue_task_queue, gw_task_queue, mac_task_queue;
// derived // derived
std::unique_ptr<mac_nr> m_mac; std::unique_ptr<mac_nr> m_mac;

@ -124,7 +124,7 @@ private:
mac_args_t args = {}; mac_args_t args = {};
// derived from args // derived from args
srslte::task_multiqueue::queue_handler stack_task_queue; srslte::task_multiqueue::queue_handle stack_task_queue;
bool started = false; bool started = false;

@ -248,21 +248,16 @@ void enb_stack_lte::add_gtpu_m1u_socket_handler(int fd)
rx_sockets->add_socket_pdu_handler(fd, gtpu_m1u_handler); rx_sockets->add_socket_pdu_handler(fd, gtpu_m1u_handler);
} }
srslte::timer_handler::unique_timer enb_stack_lte::get_unique_timer() srslte::unique_timer enb_stack_lte::get_unique_timer()
{ {
return task_sched.get_unique_timer(); return task_sched.get_unique_timer();
} }
srslte::task_multiqueue::queue_handler enb_stack_lte::make_task_queue() srslte::task_queue_handle enb_stack_lte::make_task_queue()
{ {
return task_sched.make_task_queue(); return task_sched.make_task_queue();
} }
srslte::task_multiqueue::queue_handler enb_stack_lte::make_task_queue(uint32_t qsize)
{
return task_sched.make_task_queue(qsize);
}
void enb_stack_lte::defer_callback(uint32_t duration_ms, std::function<void()> func) void enb_stack_lte::defer_callback(uint32_t duration_ms, std::function<void()> func)
{ {
task_sched.defer_callback(duration_ms, std::move(func)); task_sched.defer_callback(duration_ms, std::move(func));

@ -163,8 +163,8 @@ private:
void timer_alignment_expire(); void timer_alignment_expire();
/* Queue to dispatch stack tasks */ /* Queue to dispatch stack tasks */
srslte::task_multiqueue::queue_handler stack_task_dispatch_queue; srslte::task_multiqueue::queue_handle stack_task_dispatch_queue;
srslte::byte_buffer_pool* pool = nullptr; srslte::byte_buffer_pool* pool = nullptr;
// pointer to MAC PCAP object // pointer to MAC PCAP object
srslte::mac_pcap* pcap = nullptr; srslte::mac_pcap* pcap = nullptr;

@ -111,7 +111,7 @@ private:
srslte::unique_byte_buffer_t tx_buffer = nullptr; srslte::unique_byte_buffer_t tx_buffer = nullptr;
srslte::unique_byte_buffer_t rlc_buffer = nullptr; srslte::unique_byte_buffer_t rlc_buffer = nullptr;
srslte::task_multiqueue::queue_handler stack_task_dispatch_queue; srslte::task_multiqueue::queue_handle stack_task_dispatch_queue;
}; };
} // namespace srsue } // namespace srsue

@ -126,16 +126,12 @@ public:
tti_point get_current_tti() final { return current_tti; } tti_point get_current_tti() final { return current_tti; }
// Task Handling interface // Task Handling interface
srslte::timer_handler::unique_timer get_unique_timer() final { return task_sched.get_unique_timer(); } srslte::unique_timer get_unique_timer() final { return task_sched.get_unique_timer(); }
srslte::task_multiqueue::queue_handler make_task_queue() final { return task_sched.make_task_queue(); } srslte::task_multiqueue::queue_handle make_task_queue() final { return task_sched.make_task_queue(); }
srslte::task_multiqueue::queue_handler make_task_queue(uint32_t queue_size) final void enqueue_background_task(std::function<void(uint32_t)> f) final;
{ void notify_background_task_result(srslte::move_task_t task) final;
return task_sched.make_task_queue(queue_size); void defer_callback(uint32_t duration_ms, std::function<void()> func) final;
} void defer_task(srslte::move_task_t task) final;
void enqueue_background_task(std::function<void(uint32_t)> f) final;
void notify_background_task_result(srslte::move_task_t task) final;
void defer_callback(uint32_t duration_ms, std::function<void()> func) final;
void defer_task(srslte::move_task_t task) final;
private: private:
void run_thread() final; void run_thread() final;
@ -167,10 +163,10 @@ private:
gw_interface_stack* gw = nullptr; gw_interface_stack* gw = nullptr;
// Thread // Thread
static const int STACK_MAIN_THREAD_PRIO = 4; // Next lower priority after PHY workers static const int STACK_MAIN_THREAD_PRIO = 4; // Next lower priority after PHY workers
srslte::block_queue<stack_metrics_t> pending_stack_metrics; srslte::block_queue<stack_metrics_t> pending_stack_metrics;
task_scheduler task_sched; task_scheduler task_sched;
srslte::task_multiqueue::queue_handler sync_task_queue, ue_task_queue, gw_queue_id; srslte::task_multiqueue::queue_handle sync_task_queue, ue_task_queue, gw_queue_id;
// TTI stats // TTI stats
srslte::tprof<srslte::sliding_window_stats_ms> tti_tprof; srslte::tprof<srslte::sliding_window_stats_ms> tti_tprof;

@ -97,16 +97,12 @@ public:
srslte::tti_point get_current_tti() { return srslte::tti_point{0}; }; srslte::tti_point get_current_tti() { return srslte::tti_point{0}; };
// Task Handling interface // Task Handling interface
srslte::timer_handler::unique_timer get_unique_timer() final { return task_sched.get_unique_timer(); } srslte::timer_handler::unique_timer get_unique_timer() final { return task_sched.get_unique_timer(); }
srslte::task_multiqueue::queue_handler make_task_queue() final { return task_sched.make_task_queue(); } srslte::task_multiqueue::queue_handle make_task_queue() final { return task_sched.make_task_queue(); }
srslte::task_multiqueue::queue_handler make_task_queue(uint32_t qsize) final void enqueue_background_task(std::function<void(uint32_t)> f) final;
{ void notify_background_task_result(srslte::move_task_t task) final;
return task_sched.make_task_queue(qsize); void defer_callback(uint32_t duration_ms, std::function<void()> func) final;
} void defer_task(srslte::move_task_t task) final;
void enqueue_background_task(std::function<void(uint32_t)> f) final;
void notify_background_task_result(srslte::move_task_t task) final;
void defer_callback(uint32_t duration_ms, std::function<void()> func) final;
void defer_task(srslte::move_task_t task) final;
private: private:
void run_thread() final; void run_thread() final;
@ -117,8 +113,8 @@ private:
srsue::stack_args_t args = {}; srsue::stack_args_t args = {};
// task scheduler // task scheduler
srslte::task_scheduler task_sched; srslte::task_scheduler task_sched;
srslte::task_multiqueue::queue_handler sync_task_queue, ue_task_queue, gw_task_queue; srslte::task_multiqueue::queue_handle sync_task_queue, ue_task_queue, gw_task_queue;
// UE stack logging // UE stack logging
srslte::logger* logger = nullptr; srslte::logger* logger = nullptr;

Loading…
Cancel
Save