lib,rlc_am_nr: make sure that tx_buffer_queue size is configurable

master
Pedro Alvarez 3 years ago
parent 10c921573f
commit 63877ba209

@ -101,6 +101,7 @@ public:
int write_sdu(unique_byte_buffer_t sdu); int write_sdu(unique_byte_buffer_t sdu);
void empty_queue() final; void empty_queue() final;
void empty_queue_no_lock();
// Data PDU helpers // Data PDU helpers
uint32_t build_new_pdu(uint8_t* payload, uint32_t nof_bytes); uint32_t build_new_pdu(uint8_t* payload, uint32_t nof_bytes);
@ -151,8 +152,8 @@ private:
// Queues, buffers and container // Queues, buffers and container
std::unique_ptr<pdu_retx_queue_base<rlc_amd_retx_nr_t> > retx_queue; std::unique_ptr<pdu_retx_queue_base<rlc_amd_retx_nr_t> > retx_queue;
uint32_t sdu_under_segmentation_sn = INVALID_RLC_SN; // SN of the SDU currently being segmented. uint32_t sdu_under_segmentation_sn = INVALID_RLC_SN; // SN of the SDU currently being segmented.
pdcp_sn_vector_t notify_info_vec; pdcp_sn_vector_t notify_info_vec;
// Helper constants // Helper constants
uint32_t min_hdr_size = 2; uint32_t min_hdr_size = 2;

@ -79,17 +79,18 @@ bool rlc_am::configure(const rlc_config_t& cfg_)
if (cfg.rat == srsran_rat_t::lte) { if (cfg.rat == srsran_rat_t::lte) {
RlcInfo("AM LTE configured - t_poll_retx=%d, poll_pdu=%d, poll_byte=%d, max_retx_thresh=%d, " RlcInfo("AM LTE configured - t_poll_retx=%d, poll_pdu=%d, poll_byte=%d, max_retx_thresh=%d, "
"t_reordering=%d, t_status_prohibit=%d", "t_reordering=%d, t_status_prohibit=%d, tx_queue_length=%d",
cfg.am.t_poll_retx, cfg.am.t_poll_retx,
cfg.am.poll_pdu, cfg.am.poll_pdu,
cfg.am.poll_byte, cfg.am.poll_byte,
cfg.am.max_retx_thresh, cfg.am.max_retx_thresh,
cfg.am.t_reordering, cfg.am.t_reordering,
cfg.am.t_status_prohibit); cfg.am.t_status_prohibit,
cfg.tx_queue_length);
} else if (cfg.rat == srsran_rat_t::nr) { } else if (cfg.rat == srsran_rat_t::nr) {
RlcInfo("AM NR configured - tx_sn_field_length=%d, rx_sn_field_length=%d, " RlcInfo("AM NR configured - tx_sn_field_length=%d, rx_sn_field_length=%d, "
"t_poll_retx=%d, poll_pdu=%d, poll_byte=%d, " "t_poll_retx=%d, poll_pdu=%d, poll_byte=%d, "
"max_retx_thresh=%d, t_reassembly=%d, t_status_prohibit=%d", "max_retx_thresh=%d, t_reassembly=%d, t_status_prohibit=%di, tx_queue_length=%d",
to_number(cfg.am_nr.tx_sn_field_length), to_number(cfg.am_nr.tx_sn_field_length),
to_number(cfg.am_nr.rx_sn_field_length), to_number(cfg.am_nr.rx_sn_field_length),
cfg.am_nr.t_poll_retx, cfg.am_nr.t_poll_retx,
@ -97,7 +98,8 @@ bool rlc_am::configure(const rlc_config_t& cfg_)
cfg.am_nr.poll_byte, cfg.am_nr.poll_byte,
cfg.am_nr.max_retx_thresh, cfg.am_nr.max_retx_thresh,
cfg.am_nr.t_reassembly, cfg.am_nr.t_reassembly,
cfg.am_nr.t_status_prohibit); cfg.am_nr.t_status_prohibit,
cfg.tx_queue_length);
} else { } else {
RlcError("Invalid RAT at entity configuration"); RlcError("Invalid RAT at entity configuration");
} }

@ -69,6 +69,10 @@ bool rlc_am_nr_tx::configure(const rlc_config_t& cfg_)
max_hdr_size = min_hdr_size + so_size; max_hdr_size = min_hdr_size + so_size;
// make sure Tx queue is empty before attempting to resize
empty_queue_no_lock();
tx_sdu_queue.resize(cfg_.tx_queue_length);
tx_enabled = true; tx_enabled = true;
RlcDebug("RLC AM NR configured tx entity."); RlcDebug("RLC AM NR configured tx entity.");
@ -725,7 +729,7 @@ uint32_t rlc_am_nr_tx::build_status_pdu(byte_buffer_t* payload, uint32_t nof_byt
{ {
RlcInfo("generating status PDU. Bytes available:%d", nof_bytes); RlcInfo("generating status PDU. Bytes available:%d", nof_bytes);
rlc_am_nr_status_pdu_t status(cfg.rx_sn_field_length); // carries status of RX entity, hence use SN length of RX rlc_am_nr_status_pdu_t status(cfg.rx_sn_field_length); // carries status of RX entity, hence use SN length of RX
int pdu_len = rx->get_status_pdu(&status, nof_bytes); int pdu_len = rx->get_status_pdu(&status, nof_bytes);
if (pdu_len == SRSRAN_ERROR) { if (pdu_len == SRSRAN_ERROR) {
RlcDebug("deferred status PDU. Cause: Failed to acquire rx lock"); RlcDebug("deferred status PDU. Cause: Failed to acquire rx lock");
pdu_len = 0; pdu_len = 0;
@ -1063,8 +1067,19 @@ bool rlc_am_nr_tx::sdu_queue_is_full()
return false; return false;
} }
void rlc_am_nr_tx::empty_queue() {} void rlc_am_nr_tx::empty_queue()
{
std::lock_guard<std::mutex> lock(mutex);
empty_queue_no_lock();
}
void rlc_am_nr_tx::empty_queue_no_lock()
{
// deallocate all SDUs in transmit queue
while (tx_sdu_queue.size() > 0) {
unique_byte_buffer_t buf = tx_sdu_queue.read();
}
}
void rlc_am_nr_tx::stop() {} void rlc_am_nr_tx::stop() {}
/* /*

Loading…
Cancel
Save