diff --git a/lib/include/srslte/upper/rlc_tx_queue.h b/lib/include/srslte/upper/byte_buffer_queue.h similarity index 75% rename from lib/include/srslte/upper/rlc_tx_queue.h rename to lib/include/srslte/upper/byte_buffer_queue.h index 6abf9cb18..db819dcf8 100644 --- a/lib/include/srslte/upper/rlc_tx_queue.h +++ b/lib/include/srslte/upper/byte_buffer_queue.h @@ -19,16 +19,16 @@ * */ -/****************************************************************************** - * File: rlc_tx_queue.h - * Description: Queue used in RLC TM/UM/AM TX queues. - * Uses a blocking queue with bounded capacity to block higher layers - * when pushing Uplink traffic - * Reference: - *****************************************************************************/ +/* + * @file byte_buffer_queue.h + * + * @brief Queue of unique pointers to byte buffers used in PDCP and RLC TX queues. + * Uses a blocking queue with bounded capacity to block higher layers + * when pushing uplink traffic + */ -#ifndef SRSLTE_MSG_QUEUE_H -#define SRSLTE_MSG_QUEUE_H +#ifndef SRSLTE_BYTE_BUFFERQUEUE_H +#define SRSLTE_BYTE_BUFFERQUEUE_H #include "srslte/common/block_queue.h" #include "srslte/common/common.h" @@ -36,14 +36,10 @@ namespace srslte { -class rlc_tx_queue : public block_queue::call_mutexed_itf +class byte_buffer_queue : public block_queue::call_mutexed_itf { public: - rlc_tx_queue(int capacity = 128) : queue(capacity) - { - unread_bytes = 0; - queue.set_mutexed_itf(this); - } + byte_buffer_queue(int capacity = 128) : queue(capacity) { queue.set_mutexed_itf(this); } // increase/decrease unread_bytes inside push/pop mutexed operations void pushing(const unique_byte_buffer_t& msg) final { unread_bytes += msg->N_bytes; } void popping(const unique_byte_buffer_t& msg) final @@ -90,9 +86,9 @@ public: private: block_queue queue; - uint32_t unread_bytes; + uint32_t unread_bytes = 0; }; } // namespace srslte -#endif // SRSLTE_MSG_QUEUE_H +#endif // SRSLTE_BYTE_BUFFERQUEUE_H diff --git a/lib/include/srslte/upper/pdcp_entity_base.h b/lib/include/srslte/upper/pdcp_entity_base.h index e07815bd3..e23c1c1fb 100644 --- a/lib/include/srslte/upper/pdcp_entity_base.h +++ b/lib/include/srslte/upper/pdcp_entity_base.h @@ -31,6 +31,7 @@ #include "srslte/common/threads.h" #include "srslte/common/timers.h" #include "srslte/interfaces/pdcp_interface_types.h" +#include "srslte/upper/byte_buffer_queue.h" namespace srslte { diff --git a/lib/include/srslte/upper/rlc_am_base.h b/lib/include/srslte/upper/rlc_am_base.h index a66670781..09654b07f 100644 --- a/lib/include/srslte/upper/rlc_am_base.h +++ b/lib/include/srslte/upper/rlc_am_base.h @@ -26,8 +26,8 @@ #include "srslte/common/common.h" #include "srslte/common/log.h" #include "srslte/interfaces/ue_interfaces.h" +#include "srslte/upper/byte_buffer_queue.h" #include "srslte/upper/rlc_common.h" -#include "srslte/upper/rlc_tx_queue.h" #include #include #include diff --git a/lib/include/srslte/upper/rlc_am_lte.h b/lib/include/srslte/upper/rlc_am_lte.h index e6bb8eee7..1edc5fa30 100644 --- a/lib/include/srslte/upper/rlc_am_lte.h +++ b/lib/include/srslte/upper/rlc_am_lte.h @@ -27,9 +27,9 @@ #include "srslte/common/log.h" #include "srslte/common/timeout.h" #include "srslte/interfaces/ue_interfaces.h" +#include "srslte/upper/byte_buffer_queue.h" #include "srslte/upper/rlc_am_base.h" #include "srslte/upper/rlc_common.h" -#include "srslte/upper/rlc_tx_queue.h" #include #include #include @@ -154,7 +154,7 @@ private: rlc_am_config_t cfg = {}; // TX SDU buffers - rlc_tx_queue tx_sdu_queue; + byte_buffer_queue tx_sdu_queue; unique_byte_buffer_t tx_sdu; bool tx_enabled = false; diff --git a/lib/include/srslte/upper/rlc_am_nr.h b/lib/include/srslte/upper/rlc_am_nr.h index 1ebaf7ab6..f8fb153c8 100644 --- a/lib/include/srslte/upper/rlc_am_nr.h +++ b/lib/include/srslte/upper/rlc_am_nr.h @@ -26,8 +26,8 @@ #include "srslte/common/common.h" #include "srslte/common/log.h" #include "srslte/interfaces/ue_interfaces.h" +#include "srslte/upper/byte_buffer_queue.h" #include "srslte/upper/rlc_am_base.h" -#include "srslte/upper/rlc_tx_queue.h" #include #include #include diff --git a/lib/include/srslte/upper/rlc_tm.h b/lib/include/srslte/upper/rlc_tm.h index 8dadc0734..9d1e4d05f 100644 --- a/lib/include/srslte/upper/rlc_tm.h +++ b/lib/include/srslte/upper/rlc_tm.h @@ -26,8 +26,8 @@ #include "srslte/common/common.h" #include "srslte/common/log.h" #include "srslte/interfaces/ue_interfaces.h" +#include "srslte/upper/byte_buffer_queue.h" #include "srslte/upper/rlc_common.h" -#include "srslte/upper/rlc_tx_queue.h" namespace srslte { @@ -77,7 +77,7 @@ private: rlc_bearer_metrics_t metrics = {}; // Thread-safe queues for MAC messages - rlc_tx_queue ul_queue; + byte_buffer_queue ul_queue; }; } // namespace srslte diff --git a/lib/include/srslte/upper/rlc_um_base.h b/lib/include/srslte/upper/rlc_um_base.h index db4c3aa14..f69c77024 100644 --- a/lib/include/srslte/upper/rlc_um_base.h +++ b/lib/include/srslte/upper/rlc_um_base.h @@ -26,8 +26,8 @@ #include "srslte/common/common.h" #include "srslte/common/log.h" #include "srslte/interfaces/ue_interfaces.h" +#include "srslte/upper/byte_buffer_queue.h" #include "srslte/upper/rlc_common.h" -#include "srslte/upper/rlc_tx_queue.h" #include #include #include @@ -97,7 +97,7 @@ protected: rlc_config_t cfg = {}; // TX SDU buffers - rlc_tx_queue tx_sdu_queue; + byte_buffer_queue tx_sdu_queue; unique_byte_buffer_t tx_sdu; // Mutexes diff --git a/lib/include/srslte/upper/rlc_um_lte.h b/lib/include/srslte/upper/rlc_um_lte.h index 6bd108555..7c836adf1 100644 --- a/lib/include/srslte/upper/rlc_um_lte.h +++ b/lib/include/srslte/upper/rlc_um_lte.h @@ -26,7 +26,7 @@ #include "srslte/common/common.h" #include "srslte/common/log.h" #include "srslte/interfaces/ue_interfaces.h" -#include "srslte/upper/rlc_tx_queue.h" +#include "srslte/upper/byte_buffer_queue.h" #include "srslte/upper/rlc_um_base.h" #include #include diff --git a/lib/include/srslte/upper/rlc_um_nr.h b/lib/include/srslte/upper/rlc_um_nr.h index ed76ae75c..003361762 100644 --- a/lib/include/srslte/upper/rlc_um_nr.h +++ b/lib/include/srslte/upper/rlc_um_nr.h @@ -26,7 +26,7 @@ #include "srslte/common/common.h" #include "srslte/common/log.h" #include "srslte/interfaces/ue_interfaces.h" -#include "srslte/upper/rlc_tx_queue.h" +#include "srslte/upper/byte_buffer_queue.h" #include "srslte/upper/rlc_um_base.h" #include #include diff --git a/lib/test/common/CMakeLists.txt b/lib/test/common/CMakeLists.txt index a9413dbb0..8b3fd51a5 100644 --- a/lib/test/common/CMakeLists.txt +++ b/lib/test/common/CMakeLists.txt @@ -27,9 +27,9 @@ add_executable(logger_test logger_test.cc) target_link_libraries(logger_test srslte_phy srslte_common srslte_phy ${SEC_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES}) add_test(logger_test logger_test) -add_executable(msg_queue_test msg_queue_test.cc) -target_link_libraries(msg_queue_test srslte_phy srslte_common ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES}) -add_test(msg_queue_test msg_queue_test) +add_executable(byte_buffer_queue_test byte_buffer_queue_test.cc) +target_link_libraries(byte_buffer_queue_test srslte_phy srslte_common ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES}) +add_test(byte_buffer_queue_test byte_buffer_queue_test) add_executable(test_eia1 test_eia1.cc) target_link_libraries(test_eia1 srslte_common srslte_phy ${CMAKE_THREAD_LIBS_INIT}) diff --git a/lib/test/common/msg_queue_test.cc b/lib/test/common/byte_buffer_queue_test.cc similarity index 95% rename from lib/test/common/msg_queue_test.cc rename to lib/test/common/byte_buffer_queue_test.cc index d1b29c50f..cb5c19532 100644 --- a/lib/test/common/msg_queue_test.cc +++ b/lib/test/common/byte_buffer_queue_test.cc @@ -22,13 +22,13 @@ #define NMSGS 1000000 #include "srslte/common/buffer_pool.h" -#include "srslte/upper/rlc_tx_queue.h" +#include "srslte/upper/byte_buffer_queue.h" #include using namespace srslte; typedef struct { - rlc_tx_queue* q; + byte_buffer_queue* q; } args_t; void* write_thread(void* a) @@ -47,7 +47,7 @@ void* write_thread(void* a) int main(int argc, char** argv) { bool result; - rlc_tx_queue q; + byte_buffer_queue q; unique_byte_buffer_t b; pthread_t thread; args_t args;