Change interface to unique_byte_buffer

logging message for msg3 preparing
master
David Rupprecht 4 years ago committed by David Rupprecht
parent 3af0342418
commit 82a8dcc77a

@ -61,7 +61,7 @@ public:
/// Indicate reception of UL grant (only TBS is provided). Buffer for resulting MAC PDU is provided by MAC and is
/// passed as pointer to PHY during tx_reuqest
virtual void new_grant_ul(const uint32_t cc_idx, const mac_nr_grant_ul_t& grant) = 0;
virtual void new_grant_ul(const uint32_t cc_idx, const mac_nr_grant_ul_t& grant, srslte::unique_byte_buffer_t phy_tx_pdu) = 0;
/**
* @brief Indicate the successful transmission of a PRACH.

@ -217,7 +217,8 @@ int srslte_basic_vnf::handle_ul_ind(basic_vnf_api::ul_ind_msg_t* msg)
ul_grant.tti = msg->tti;
ul_grant.tbs = msg->pdus.length;
ul_grant.rnti = msg->rnti;
m_ue_stack->new_grant_ul(cc_idx, ul_grant);
srslte::unique_byte_buffer_t tx_pdu = srslte::make_byte_buffer();
m_ue_stack->new_grant_ul(cc_idx, ul_grant, std::move(tx_pdu));
return SRSLTE_SUCCESS;
}

@ -52,7 +52,7 @@ public:
int sf_indication(const uint32_t tti);
void tb_decoded(const uint32_t cc_idx, mac_nr_grant_dl_t& grant);
void new_grant_ul(const uint32_t cc_idx, const mac_nr_grant_ul_t& grant);
void new_grant_ul(const uint32_t cc_idx, const mac_nr_grant_ul_t& grant, srslte::unique_byte_buffer_t tx_pdu);
void prach_sent(const uint32_t tti,
const uint32_t s_id,
const uint32_t t_id,
@ -95,7 +95,7 @@ public:
private:
void write_pcap(const uint32_t cc_idx, mac_nr_grant_dl_t& grant); // If PCAPs are enabled for this MAC
void handle_pdu(srslte::unique_byte_buffer_t pdu);
void get_ul_data(const mac_nr_grant_ul_t& grant, phy_interface_stack_nr::tx_request_t* tx_request);
void get_ul_data(const mac_nr_grant_ul_t& grant, srslte::unique_byte_buffer_t tx_pdu);
// temporary helper
void handle_rar_pdu(mac_nr_grant_dl_t& grant);

@ -126,7 +126,7 @@ public:
int sf_indication(const uint32_t tti) final { return SRSLTE_SUCCESS; }
void tb_decoded(const uint32_t cc_idx, mac_nr_grant_dl_t& grant) final { mac_nr.tb_decoded(cc_idx, grant); }
void new_grant_ul(const uint32_t cc_idx, const mac_nr_grant_ul_t& grant) final { mac_nr.new_grant_ul(cc_idx, grant); }
void new_grant_ul(const uint32_t cc_idx, const mac_nr_grant_ul_t& grant, srslte::unique_byte_buffer_t tx_pdu) final { mac_nr.new_grant_ul(cc_idx, grant, std::move(tx_pdu)); }
void run_tti(const uint32_t tti) final
{

@ -82,7 +82,7 @@ public:
return SRSLTE_SUCCESS;
}
void tb_decoded(const uint32_t cc_idx, mac_nr_grant_dl_t& grant) final { mac->tb_decoded(cc_idx, grant); }
void new_grant_ul(const uint32_t cc_idx, const mac_nr_grant_ul_t& grant) final { mac->new_grant_ul(cc_idx, grant); }
void new_grant_ul(const uint32_t cc_idx, const mac_nr_grant_ul_t& grant, srslte::unique_byte_buffer_t phy_tx_pdu) final { mac->new_grant_ul(cc_idx, grant, std::move(phy_tx_pdu)); }
void prach_sent(uint32_t tti, uint32_t s_id, uint32_t t_id, uint32_t f_id, uint32_t ul_carrier_id)
{
mac->prach_sent(tti, s_id, t_id, f_id, ul_carrier_id);

@ -288,7 +288,7 @@ bool cc_worker::work_ul()
mac_ul_grant.tti = ul_slot_cfg.idx;
mac_ul_grant.tbs = pusch_cfg.grant.tb[0].tbs;
srslte::unique_byte_buffer_t tx_pdu = srslte::make_byte_buffer();
phy->stack->new_grant_ul(0, mac_ul_grant, tx_pdu.get());
phy->stack->new_grant_ul(0, mac_ul_grant, std::move(tx_pdu));
// Provisional reset and assign Tx softbuffer
srslte_softbuffer_tx_reset(&softbuffer_tx);
pusch_cfg.grant.tb[0].softbuffer.tx = &softbuffer_tx;

@ -198,23 +198,15 @@ void mac_nr::tb_decoded(const uint32_t cc_idx, mac_nr_grant_dl_t& grant)
stack_task_dispatch_queue.push([this]() { process_pdus(); });
}
void mac_nr::new_grant_ul(const uint32_t cc_idx, const mac_nr_grant_ul_t& grant)
void mac_nr::new_grant_ul(const uint32_t cc_idx, const mac_nr_grant_ul_t& grant, srslte::unique_byte_buffer_t phy_tx_pdu)
{
phy_interface_stack_nr::tx_request_t tx_request = {};
get_ul_data(grant, &tx_request);
// send TX.request
phy->tx_request(tx_request);
get_ul_data(grant, std::move(phy_tx_pdu));
metrics[cc_idx].tx_pkts++;
}
void mac_nr::get_ul_data(const mac_nr_grant_ul_t& grant, phy_interface_stack_nr::tx_request_t* tx_request)
void mac_nr::get_ul_data(const mac_nr_grant_ul_t& grant, srslte::unique_byte_buffer_t phy_tx_pdu)
{
// Todo: delegate to mux class
tx_request->tb_len = grant.tbs;
// initialize MAC PDU
tx_buffer->clear();
tx_pdu.init_tx(tx_buffer.get(), grant.tbs, true);
@ -256,11 +248,11 @@ void mac_nr::get_ul_data(const mac_nr_grant_ul_t& grant, phy_interface_stack_nr:
logger.info(tx_buffer->msg, tx_buffer->N_bytes, "Generated MAC PDU (%d B)", tx_buffer->N_bytes);
tx_request->data = tx_buffer->msg;
tx_request->tb_len = tx_buffer->N_bytes;
memcpy(phy_tx_pdu.get()->msg, tx_buffer->msg, tx_buffer->N_bytes);
phy_tx_pdu.get()->N_bytes = tx_buffer->N_bytes;
if (pcap) {
pcap->write_ul_crnti_nr(tx_request->data, tx_request->tb_len, grant.rnti, grant.pid, grant.tti);
pcap->write_ul_crnti_nr(tx_buffer->msg, tx_buffer->N_bytes, grant.rnti, grant.pid, grant.tti);
}
}

@ -177,6 +177,7 @@ void proc_ra_nr::ra_response_reception(const mac_interface_phy_nr::mac_nr_grant_
for (auto& subpdu : pdu.get_subpdus()) {
if (subpdu.has_rapid() && subpdu.get_rapid() == preamble_index) {
logger.info("PROC RA NR: Setting ul grant and prepare msg3");
phy->set_ul_grant(subpdu.get_ul_grant());
// reset all parameters that are used before rar
rar_rnti = SRSLTE_INVALID_RNTI;

Loading…
Cancel
Save