mirror of https://github.com/PentHertz/srsLTE.git
move tx payload buffers of mac::ue to separate cc buffer handler class
This commit is contained in:
parent
9eb46cc134
commit
2f95862932
|
@ -32,6 +32,21 @@ class rrc_interface_mac;
|
||||||
class rlc_interface_mac;
|
class rlc_interface_mac;
|
||||||
class phy_interface_stack_lte;
|
class phy_interface_stack_lte;
|
||||||
|
|
||||||
|
class cc_buffer_handler
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
cc_buffer_handler();
|
||||||
|
|
||||||
|
srslte::byte_buffer_t* get_tx_payload_buffer(size_t harq_pid, size_t tb)
|
||||||
|
{
|
||||||
|
return tx_payload_buffer[harq_pid][tb].get();
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
// One buffer per TB per HARQ process and per carrier is needed for each UE.
|
||||||
|
std::array<std::array<srslte::unique_byte_buffer_t, SRSLTE_MAX_TB>, SRSLTE_FDD_NOF_HARQ> tx_payload_buffer;
|
||||||
|
};
|
||||||
|
|
||||||
class ue : public srslte::read_pdu_interface, public srslte::pdu_queue::process_callback, public mac_ta_ue_interface
|
class ue : public srslte::read_pdu_interface, public srslte::pdu_queue::process_callback, public mac_ta_ue_interface
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -124,9 +139,7 @@ private:
|
||||||
cc_softbuffer_rx_list_t; ///< List of Rx softbuffers for all HARQ processes of one carrier
|
cc_softbuffer_rx_list_t; ///< List of Rx softbuffers for all HARQ processes of one carrier
|
||||||
std::vector<cc_softbuffer_rx_list_t> softbuffer_rx; ///< List of softbuffer lists for Rx
|
std::vector<cc_softbuffer_rx_list_t> softbuffer_rx; ///< List of softbuffer lists for Rx
|
||||||
|
|
||||||
// One buffer per TB per HARQ process and per carrier is needed for each UE.
|
std::vector<cc_buffer_handler> cc_buffers;
|
||||||
std::vector<std::array<std::array<srslte::unique_byte_buffer_t, SRSLTE_MAX_TB>, SRSLTE_FDD_NOF_HARQ> >
|
|
||||||
tx_payload_buffer;
|
|
||||||
|
|
||||||
std::mutex rx_buffers_mutex;
|
std::mutex rx_buffers_mutex;
|
||||||
std::vector<std::map<uint32_t, uint8_t*> > rx_used_buffers;
|
std::vector<std::map<uint32_t, uint8_t*> > rx_used_buffers;
|
||||||
|
|
|
@ -23,6 +23,15 @@
|
||||||
|
|
||||||
namespace srsenb {
|
namespace srsenb {
|
||||||
|
|
||||||
|
cc_buffer_handler::cc_buffer_handler()
|
||||||
|
{
|
||||||
|
for (auto& harq_buffers : tx_payload_buffer) {
|
||||||
|
for (srslte::unique_byte_buffer_t& tb_buffer : harq_buffers) {
|
||||||
|
tb_buffer = srslte::make_byte_buffer();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ue::ue(uint16_t rnti_,
|
ue::ue(uint16_t rnti_,
|
||||||
uint32_t nof_prb_,
|
uint32_t nof_prb_,
|
||||||
sched_interface* sched_,
|
sched_interface* sched_,
|
||||||
|
@ -51,14 +60,7 @@ ue::ue(uint16_t rnti_,
|
||||||
rx_used_buffers(nof_cells_),
|
rx_used_buffers(nof_cells_),
|
||||||
ta_fsm(this)
|
ta_fsm(this)
|
||||||
{
|
{
|
||||||
tx_payload_buffer.resize(nof_cells_);
|
cc_buffers.resize(nof_cells_);
|
||||||
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::make_byte_buffer();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pdus.init(this);
|
pdus.init(this);
|
||||||
|
|
||||||
|
@ -507,8 +509,9 @@ 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();
|
srslte::byte_buffer_t* buffer = cc_buffers[ue_cc_idx].get_tx_payload_buffer(harq_pid, tb_idx);
|
||||||
mac_msg_dl.init_tx(tx_payload_buffer[ue_cc_idx][harq_pid][tb_idx].get(), grant_size, false);
|
buffer->clear();
|
||||||
|
mac_msg_dl.init_tx(buffer, 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 <= (uint32_t)srslte::ul_sch_lcid::PHR_REPORT) {
|
if (pdu[i].lcid <= (uint32_t)srslte::ul_sch_lcid::PHR_REPORT) {
|
||||||
allocate_sdu(&mac_msg_dl, pdu[i].lcid, pdu[i].nbytes);
|
allocate_sdu(&mac_msg_dl, pdu[i].lcid, pdu[i].nbytes);
|
||||||
|
@ -535,8 +538,9 @@ 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();
|
srslte::byte_buffer_t* buffer = cc_buffers[0].get_tx_payload_buffer(harq_pid, 0);
|
||||||
mch_mac_msg_dl.init_tx(tx_payload_buffer[0][harq_pid][0].get(), grant_size);
|
buffer->clear();
|
||||||
|
mch_mac_msg_dl.init_tx(buffer, 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 == (uint32_t)srslte::mch_lcid::MCH_SCHED_INFO) {
|
if (sched_.pdu[i].lcid == (uint32_t)srslte::mch_lcid::MCH_SCHED_INFO) {
|
||||||
|
|
Loading…
Reference in New Issue