rename rlc_tx_queue to byte_buffer_queue

this data structure will be used by the PDCP layer as well.
This commit is contained in:
Andre Puschmann 2020-07-13 17:19:38 +02:00
parent 4fd5395903
commit c8b4ba885b
11 changed files with 30 additions and 33 deletions

View File

@ -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<unique_byte_buffer_t>::call_mutexed_itf
class byte_buffer_queue : public block_queue<unique_byte_buffer_t>::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<unique_byte_buffer_t> queue;
uint32_t unread_bytes;
uint32_t unread_bytes = 0;
};
} // namespace srslte
#endif // SRSLTE_MSG_QUEUE_H
#endif // SRSLTE_BYTE_BUFFERQUEUE_H

View File

@ -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 {

View File

@ -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 <map>
#include <mutex>
#include <pthread.h>

View File

@ -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 <deque>
#include <list>
#include <map>
@ -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;

View File

@ -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 <map>
#include <mutex>
#include <pthread.h>

View File

@ -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

View File

@ -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 <map>
#include <mutex>
#include <pthread.h>
@ -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

View File

@ -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 <map>
#include <mutex>

View File

@ -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 <map>
#include <mutex>

View File

@ -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})

View File

@ -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 <stdio.h>
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;