|
|
@ -161,14 +161,27 @@ ue::get_tx_softbuffer(const uint32_t ue_cc_idx, const uint32_t harq_process, con
|
|
|
|
return &softbuffer_tx.at(ue_cc_idx).at((harq_process * SRSLTE_MAX_TB + tb_idx) % nof_tx_harq_proc);
|
|
|
|
return &softbuffer_tx.at(ue_cc_idx).at((harq_process * SRSLTE_MAX_TB + tb_idx) % nof_tx_harq_proc);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
uint8_t* ue::request_buffer(const uint32_t len)
|
|
|
|
uint8_t* ue::request_buffer(uint32_t tti, const uint32_t len)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
uint8_t* pdu = nullptr;
|
|
|
|
if (len > 0) {
|
|
|
|
if (len > 0) {
|
|
|
|
return pdus.request(len);
|
|
|
|
pdu = pdus.request(len);
|
|
|
|
|
|
|
|
if (pdu) {
|
|
|
|
|
|
|
|
// Deallocate oldest buffer if we didn't deallocate it
|
|
|
|
|
|
|
|
if (rx_used_buffers[tti] != nullptr) {
|
|
|
|
|
|
|
|
pdus.deallocate(rx_used_buffers[tti]);
|
|
|
|
|
|
|
|
rx_used_buffers[tti] = nullptr;
|
|
|
|
|
|
|
|
log_h->warning("buffers: RX PDU of rnti=0x%x and pid=%d wasn't deallocated\n", rnti, tti % nof_rx_harq_proc);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
rx_used_buffers[tti] = pdu;
|
|
|
|
|
|
|
|
log_h->info("RX PDU saved for pid=%d\n", tti % nof_rx_harq_proc);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
log_h->error("buffers: Requesting buffer from pool\n");
|
|
|
|
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
log_h->warning("Requesting buffer for zero bytes\n");
|
|
|
|
printf("buffers: Requesting buffer for zero bytes\n");
|
|
|
|
return nullptr;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return pdu;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool ue::process_pdus()
|
|
|
|
bool ue::process_pdus()
|
|
|
@ -293,18 +306,28 @@ void ue::process_pdu(uint8_t* pdu, uint32_t nof_bytes, srslte::pdu_queue::channe
|
|
|
|
Debug("MAC PDU processed\n");
|
|
|
|
Debug("MAC PDU processed\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void ue::deallocate_pdu(const uint8_t* pdu_ptr)
|
|
|
|
void ue::deallocate_pdu(uint32_t tti, const uint8_t* pdu_ptr)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (pdu_ptr) {
|
|
|
|
if (pdu_ptr) {
|
|
|
|
|
|
|
|
if (rx_used_buffers[tti] == pdu_ptr) {
|
|
|
|
|
|
|
|
rx_used_buffers[tti] = nullptr;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
Warning("buffers: Unexpected RX PDU pointer in deallocate_pdu for rnti=0x%x pid=%d\n", rnti, tti % nof_rx_harq_proc);
|
|
|
|
|
|
|
|
}
|
|
|
|
pdus.deallocate(pdu_ptr);
|
|
|
|
pdus.deallocate(pdu_ptr);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
Error("Error deallocating PDU: null ptr\n");
|
|
|
|
Error("Error deallocating PDU: null ptr\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void ue::push_pdu(const uint8_t* pdu_ptr, uint32_t len)
|
|
|
|
void ue::push_pdu(uint32_t tti, const uint8_t* pdu_ptr, uint32_t len)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (pdu_ptr && len > 0) {
|
|
|
|
if (pdu_ptr && len > 0) {
|
|
|
|
|
|
|
|
if (rx_used_buffers[tti] == pdu_ptr) {
|
|
|
|
|
|
|
|
rx_used_buffers[tti] = nullptr;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
Warning("buffers: Unexpected RX PDU pointer in push_pdu for rnti=0x%x pid=%d\n", rnti, tti % nof_rx_harq_proc);
|
|
|
|
|
|
|
|
}
|
|
|
|
pdus.push(pdu_ptr, len);
|
|
|
|
pdus.push(pdu_ptr, len);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
Error("Error pushing PDU: ptr=%p, len=%d\n", pdu_ptr, len);
|
|
|
|
Error("Error pushing PDU: ptr=%p, len=%d\n", pdu_ptr, len);
|
|
|
|