use byte buffer pool for the ue tx_payload_buffer allocation. This halves the mac::ue object creation time

master
Francisco Paisana 5 years ago committed by Francisco Paisana
parent 3f10224729
commit 8772d8f85c

@ -139,7 +139,9 @@ private:
std::vector<cc_buffer_ptr_t> pending_buffers; ///< List of buffer pointer list for Rx std::vector<cc_buffer_ptr_t> pending_buffers; ///< List of buffer pointer list for Rx
// For DL there are two buffers, one for each Transport block // For DL there are two buffers, one for each Transport block
srslte::byte_buffer_t tx_payload_buffer[SRSLTE_MAX_CARRIERS][SRSLTE_FDD_NOF_HARQ][SRSLTE_MAX_TB]; std::array<std::array<std::array<srslte::unique_byte_buffer_t, SRSLTE_MAX_TB>, SRSLTE_FDD_NOF_HARQ>,
SRSLTE_MAX_CARRIERS>
tx_payload_buffer;
srslte::block_queue<uint32_t> pending_ta_commands; srslte::block_queue<uint32_t> pending_ta_commands;
ta ta_fsm; ta ta_fsm;

@ -58,6 +58,15 @@ ue::ue(uint16_t rnti_,
nof_tx_harq_proc(nof_tx_harq_proc_), nof_tx_harq_proc(nof_tx_harq_proc_),
ta_fsm(this) ta_fsm(this)
{ {
srslte::byte_buffer_pool* pool = srslte::byte_buffer_pool::get_instance();
for (auto& carrier_buffers : tx_payload_buffer) {
for (auto& harq_buffers : carrier_buffers) {
for (srslte::unique_byte_buffer_t& tb_buffer : harq_buffers) {
tb_buffer = srslte::allocate_unique_buffer(*pool);
}
}
}
pdus.init(this, log_h); pdus.init(this, log_h);
// Allocate buffer for PCell // Allocate buffer for PCell
@ -506,8 +515,8 @@ uint8_t* ue::generate_pdu(uint32_t ue_cc_idx,
uint8_t* ret = nullptr; uint8_t* ret = nullptr;
if (rlc) { if (rlc) {
if (ue_cc_idx < SRSLTE_MAX_CARRIERS && harq_pid < SRSLTE_FDD_NOF_HARQ && tb_idx < SRSLTE_MAX_TB) { if (ue_cc_idx < SRSLTE_MAX_CARRIERS && harq_pid < SRSLTE_FDD_NOF_HARQ && tb_idx < SRSLTE_MAX_TB) {
tx_payload_buffer[ue_cc_idx][harq_pid][tb_idx].clear(); tx_payload_buffer[ue_cc_idx][harq_pid][tb_idx]->clear();
mac_msg_dl.init_tx(&tx_payload_buffer[ue_cc_idx][harq_pid][tb_idx], grant_size, false); mac_msg_dl.init_tx(tx_payload_buffer[ue_cc_idx][harq_pid][tb_idx].get(), grant_size, false);
for (uint32_t i = 0; i < nof_pdu_elems; i++) { for (uint32_t i = 0; i < nof_pdu_elems; i++) {
if (pdu[i].lcid <= srslte::sch_subh::PHR_REPORT) { if (pdu[i].lcid <= srslte::sch_subh::PHR_REPORT) {
allocate_sdu(&mac_msg_dl, pdu[i].lcid, pdu[i].nbytes); allocate_sdu(&mac_msg_dl, pdu[i].lcid, pdu[i].nbytes);
@ -533,8 +542,8 @@ uint8_t* ue::generate_mch_pdu(uint32_t harq_pid,
{ {
std::lock_guard<std::mutex> lock(mutex); std::lock_guard<std::mutex> lock(mutex);
uint8_t* ret = nullptr; uint8_t* ret = nullptr;
tx_payload_buffer[0][harq_pid][0].clear(); tx_payload_buffer[0][harq_pid][0]->clear();
mch_mac_msg_dl.init_tx(&tx_payload_buffer[0][harq_pid][0], grant_size); mch_mac_msg_dl.init_tx(tx_payload_buffer[0][harq_pid][0].get(), grant_size);
for (uint32_t i = 0; i < nof_pdu_elems; i++) { for (uint32_t i = 0; i < nof_pdu_elems; i++) {
if (sched.pdu[i].lcid == srslte::sch_subh::MCH_SCHED_INFO) { if (sched.pdu[i].lcid == srslte::sch_subh::MCH_SCHED_INFO) {

Loading…
Cancel
Save