|
|
@ -16,6 +16,7 @@
|
|
|
|
#include <string.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
|
|
|
|
#include "srsenb/hdr/stack/mac/nr/ue_nr.h"
|
|
|
|
#include "srsenb/hdr/stack/mac/nr/ue_nr.h"
|
|
|
|
|
|
|
|
#include "srsran/common/buffer_pool.h"
|
|
|
|
#include "srsran/common/string_helpers.h"
|
|
|
|
#include "srsran/common/string_helpers.h"
|
|
|
|
#include "srsran/interfaces/gnb_interfaces.h"
|
|
|
|
#include "srsran/interfaces/gnb_interfaces.h"
|
|
|
|
|
|
|
|
|
|
|
@ -28,7 +29,13 @@ ue_nr::ue_nr(uint16_t rnti_,
|
|
|
|
rlc_interface_mac* rlc_,
|
|
|
|
rlc_interface_mac* rlc_,
|
|
|
|
phy_interface_stack_nr* phy_,
|
|
|
|
phy_interface_stack_nr* phy_,
|
|
|
|
srslog::basic_logger& logger_) :
|
|
|
|
srslog::basic_logger& logger_) :
|
|
|
|
rnti(rnti_), sched(sched_), rrc(rrc_), rlc(rlc_), phy(phy_), logger(logger_)
|
|
|
|
rnti(rnti_),
|
|
|
|
|
|
|
|
sched(sched_),
|
|
|
|
|
|
|
|
rrc(rrc_),
|
|
|
|
|
|
|
|
rlc(rlc_),
|
|
|
|
|
|
|
|
phy(phy_),
|
|
|
|
|
|
|
|
logger(logger_),
|
|
|
|
|
|
|
|
ue_rlc_buffer(srsran::make_byte_buffer())
|
|
|
|
{}
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
|
|
ue_nr::~ue_nr() {}
|
|
|
|
ue_nr::~ue_nr() {}
|
|
|
@ -82,20 +89,11 @@ uint32_t ue_nr::read_pdu(uint32_t lcid, uint8_t* payload, uint32_t requested_byt
|
|
|
|
return rlc->read_pdu(rnti, lcid, payload, requested_bytes);
|
|
|
|
return rlc->read_pdu(rnti, lcid, payload, requested_bytes);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
uint8_t* ue_nr::generate_pdu(uint32_t enb_cc_idx,
|
|
|
|
int ue_nr::generate_pdu(srsran::byte_buffer_t* pdu, uint32_t grant_size)
|
|
|
|
uint32_t harq_pid,
|
|
|
|
|
|
|
|
uint32_t tb_idx,
|
|
|
|
|
|
|
|
const sched_interface::dl_sched_pdu_t pdu[sched_interface::MAX_RLC_PDU_LIST],
|
|
|
|
|
|
|
|
uint32_t nof_pdu_elems,
|
|
|
|
|
|
|
|
uint32_t grant_size)
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
std::lock_guard<std::mutex> lock(mutex);
|
|
|
|
std::lock_guard<std::mutex> lock(mutex);
|
|
|
|
uint8_t* ret = nullptr;
|
|
|
|
|
|
|
|
if (enb_cc_idx < SRSRAN_MAX_CARRIERS && harq_pid < SRSRAN_FDD_NOF_HARQ && tb_idx < SRSRAN_MAX_TB) {
|
|
|
|
|
|
|
|
srsran::byte_buffer_t* buffer = nullptr; // TODO: read from scheduler output
|
|
|
|
|
|
|
|
buffer->clear();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mac_pdu_dl.init_tx(buffer, grant_size);
|
|
|
|
mac_pdu_dl.init_tx(pdu, grant_size);
|
|
|
|
|
|
|
|
|
|
|
|
// read RLC PDU
|
|
|
|
// read RLC PDU
|
|
|
|
ue_rlc_buffer->clear();
|
|
|
|
ue_rlc_buffer->clear();
|
|
|
@ -109,20 +107,17 @@ uint8_t* ue_nr::generate_pdu(uint32_t enb_cc_idx,
|
|
|
|
logger.info(ue_rlc_buffer->msg, ue_rlc_buffer->N_bytes, "Read %d B from RLC", ue_rlc_buffer->N_bytes);
|
|
|
|
logger.info(ue_rlc_buffer->msg, ue_rlc_buffer->N_bytes, "Read %d B from RLC", ue_rlc_buffer->N_bytes);
|
|
|
|
|
|
|
|
|
|
|
|
// add to MAC PDU and pack
|
|
|
|
// add to MAC PDU and pack
|
|
|
|
mac_pdu_dl.add_sdu(4, ue_rlc_buffer->msg, ue_rlc_buffer->N_bytes);
|
|
|
|
mac_pdu_dl.add_sdu(lcid, ue_rlc_buffer->msg, ue_rlc_buffer->N_bytes);
|
|
|
|
mac_pdu_dl.pack();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mac_pdu_dl.pack();
|
|
|
|
|
|
|
|
|
|
|
|
if (logger.info.enabled()) {
|
|
|
|
if (logger.info.enabled()) {
|
|
|
|
fmt::memory_buffer str_buffer;
|
|
|
|
fmt::memory_buffer str_buffer;
|
|
|
|
// mac_pdu_dl.to_string(str_buffer);
|
|
|
|
// mac_pdu_dl.to_string(str_buffer);
|
|
|
|
logger.info("0x%x %s", rnti, srsran::to_c_str(str_buffer));
|
|
|
|
logger.info("0x%x %s", rnti, srsran::to_c_str(str_buffer));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
return SRSRAN_SUCCESS;
|
|
|
|
logger.error(
|
|
|
|
|
|
|
|
"Invalid parameters calling generate_pdu: cc_idx=%d, harq_pid=%d, tb_idx=%d", enb_cc_idx, harq_pid, tb_idx);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/******* METRICS interface ***************/
|
|
|
|
/******* METRICS interface ***************/
|
|
|
|