Use static queue in pdu_queue

master
Ismael Gomez 4 years ago committed by Francisco Paisana
parent 611c5e9814
commit 7b33c48fe7

@ -50,6 +50,7 @@ public:
if (capacity_ > 0) {
nof_buffers = (uint32_t)capacity_;
}
used.reserve(nof_buffers);
pthread_mutex_init(&mutex, nullptr);
pthread_cond_init(&cv_not_empty, nullptr);
for (uint32_t i = 0; i < nof_buffers; i++) {

@ -33,9 +33,7 @@ public:
virtual void process_pdu(uint8_t* buff, uint32_t len, channel_t channel) = 0;
};
pdu_queue(srslog::basic_logger& logger, uint32_t pool_size = DEFAULT_POOL_SIZE) :
pool(pool_size), callback(NULL), logger(logger), pdu_q(pool_size)
{}
pdu_queue(srslog::basic_logger& logger) : pool(DEFAULT_POOL_SIZE), callback(NULL), logger(logger) {}
void init(process_callback* callback);
uint8_t* request(uint32_t len);
@ -47,7 +45,7 @@ public:
void reset();
private:
const static int DEFAULT_POOL_SIZE = 64; // Number of PDU buffers in total
const static int DEFAULT_POOL_SIZE = 128; // Number of PDU buffers in total
const static int MAX_PDU_LEN = 150 * 1024 / 8; // ~ 150 Mbps
typedef struct {
@ -60,8 +58,8 @@ private:
} pdu_t;
dyn_blocking_queue<pdu_t*> pdu_q;
buffer_pool<pdu_t> pool;
static_blocking_queue<pdu_t*, DEFAULT_POOL_SIZE> pdu_q;
buffer_pool<pdu_t> pool;
process_callback* callback;
srslog::basic_logger& logger;

@ -58,7 +58,9 @@ void pdu_queue::push(const uint8_t* ptr, uint32_t len, channel_t channel)
pdu_t* pdu = (pdu_t*)ptr;
pdu->len = len;
pdu->channel = channel;
pdu_q.push_blocking(pdu);
if (!pdu_q.try_push(pdu)) {
logger.warning("Error pushing pdu: queue is full");
}
} else {
logger.warning("Error pushing pdu: ptr is empty");
}

@ -107,11 +107,11 @@ ue::ue(uint16_t rnti_,
rrc(rrc_),
rlc(rlc_),
phy(phy_),
logger(logger_),
mac_msg_dl(20, logger_),
mch_mac_msg_dl(10, logger_),
mac_msg_ul(20, logger_),
pdus(logger_, 128),
logger(logger),
mac_msg_dl(20, logger),
mch_mac_msg_dl(10, logger),
mac_msg_ul(20, logger),
pdus(logger),
nof_rx_harq_proc(nof_rx_harq_proc_),
nof_tx_harq_proc(nof_tx_harq_proc_),
ta_fsm(this),

Loading…
Cancel
Save