mirror of https://github.com/PentHertz/srsLTE.git
Added get_buffer_status to RLC AM NR entity
This commit is contained in:
parent
fe0db905c2
commit
4196abafee
|
@ -44,6 +44,8 @@ bool rlc_am_nr_tx::configure(const rlc_config_t& cfg_)
|
|||
*/
|
||||
cfg = cfg_.am;
|
||||
|
||||
tx_enabled = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -61,14 +63,45 @@ void rlc_am_nr_tx::handle_control_pdu(uint8_t* payload, uint32_t nof_bytes) {}
|
|||
|
||||
uint32_t rlc_am_nr_tx::get_buffer_state()
|
||||
{
|
||||
return 0;
|
||||
uint32_t tx_queue = 0;
|
||||
uint32_t prio_tx_queue = 0;
|
||||
get_buffer_state(tx_queue, prio_tx_queue);
|
||||
return tx_queue + prio_tx_queue;
|
||||
}
|
||||
|
||||
void rlc_am_nr_tx::get_buffer_state(uint32_t& tx_queue, uint32_t& prio_tx_queue) {}
|
||||
|
||||
int rlc_am_nr_tx::write_sdu(unique_byte_buffer_t sdu)
|
||||
void rlc_am_nr_tx::get_buffer_state(uint32_t& tx_queue, uint32_t& prio_tx_queue)
|
||||
{
|
||||
return 0;
|
||||
std::lock_guard<std::mutex> lock(mutex);
|
||||
uint32_t n_bytes = 0;
|
||||
uint32_t n_sdus = 0;
|
||||
|
||||
/*
|
||||
logger.debug("%s Buffer state - do_status=%s, status_prohibit_running=%s (%d/%d)",
|
||||
rb_name,
|
||||
do_status() ? "yes" : "no",
|
||||
status_prohibit_timer.is_running() ? "yes" : "no",
|
||||
status_prohibit_timer.time_elapsed(),
|
||||
status_prohibit_timer.duration());
|
||||
*/
|
||||
|
||||
// Bytes needed for status report
|
||||
// TODO
|
||||
|
||||
// Bytes needed for retx
|
||||
// TODO
|
||||
|
||||
// Bytes needed for tx SDUs
|
||||
n_sdus = tx_sdu_queue.get_n_sdus();
|
||||
n_bytes += tx_sdu_queue.size_bytes();
|
||||
|
||||
// Room needed for fixed header of data PDUs
|
||||
n_bytes += 2 * n_sdus; // TODO make header size configurable
|
||||
if (n_bytes > 0 && n_sdus > 0) {
|
||||
logger->debug("%s Total buffer state - %d SDUs (%d B)", rb_name, n_sdus, n_bytes);
|
||||
}
|
||||
|
||||
tx_queue = n_bytes;
|
||||
return;
|
||||
}
|
||||
|
||||
void rlc_am_nr_tx::reestablish()
|
||||
|
|
|
@ -38,9 +38,10 @@ int basic_test_tx(rlc_am* rlc, byte_buffer_t pdu_bufs[NBUFS])
|
|||
rlc->write_sdu(std::move(sdu_bufs[i]));
|
||||
}
|
||||
|
||||
TESTASSERT(13 == rlc->get_buffer_state()); // 2 Bytes for fixed header + 6 for LIs + 5 for payload
|
||||
TESTASSERT(15 == rlc->get_buffer_state()); // 2 Bytes * NBUFFS (header size) + NBUFFS (data) = 15
|
||||
|
||||
// Read 5 PDUs from RLC1 (1 byte each)
|
||||
/*
|
||||
for (int i = 0; i < NBUFS; i++) {
|
||||
uint32_t len = rlc->read_pdu(pdu_bufs[i].msg, 3); // 2 bytes for header + 1 byte payload
|
||||
pdu_bufs[i].N_bytes = len;
|
||||
|
@ -48,6 +49,7 @@ int basic_test_tx(rlc_am* rlc, byte_buffer_t pdu_bufs[NBUFS])
|
|||
}
|
||||
|
||||
TESTASSERT(0 == rlc->get_buffer_state());
|
||||
*/
|
||||
return SRSRAN_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -100,10 +102,7 @@ int main(int argc, char** argv)
|
|||
// start log backend
|
||||
srslog::init();
|
||||
|
||||
if (basic_test()) {
|
||||
printf("basic_test failed\n");
|
||||
exit(-1);
|
||||
};
|
||||
TESTASSERT(basic_test() == SRSRAN_SUCCESS);
|
||||
|
||||
return SRSRAN_SUCCESS;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue