fixed segfaulting

master
David Rupprecht 4 years ago committed by David Rupprecht
parent b768002a93
commit 1fcd006a7c

@ -62,7 +62,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, srslte::unique_byte_buffer_t phy_tx_pdu) = 0;
new_grant_ul(const uint32_t cc_idx, const mac_nr_grant_ul_t& grant, srslte::byte_buffer_t* phy_tx_pdu) = 0;
/**
* @brief Indicate the successful transmission of a PRACH.

@ -218,7 +218,7 @@ int srslte_basic_vnf::handle_ul_ind(basic_vnf_api::ul_ind_msg_t* msg)
ul_grant.tbs = msg->pdus.length;
ul_grant.rnti = msg->rnti;
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));
m_ue_stack->new_grant_ul(cc_idx, ul_grant, tx_pdu.get());
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, srslte::unique_byte_buffer_t tx_pdu);
void new_grant_ul(const uint32_t cc_idx, const mac_nr_grant_ul_t& grant, srslte::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, srslte::unique_byte_buffer_t tx_pdu);
void get_ul_data(const mac_nr_grant_ul_t& grant, srslte::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, srslte::unique_byte_buffer_t tx_pdu) final { mac_nr.new_grant_ul(cc_idx, grant, std::move(tx_pdu)); }
void new_grant_ul(const uint32_t cc_idx, const mac_nr_grant_ul_t& grant, srslte::byte_buffer_t* tx_pdu) final { mac_nr.new_grant_ul(cc_idx, grant, 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, srslte::unique_byte_buffer_t phy_tx_pdu) final { mac->new_grant_ul(cc_idx, grant, std::move(phy_tx_pdu)); }
void new_grant_ul(const uint32_t cc_idx, const mac_nr_grant_ul_t& grant, srslte::byte_buffer_t* phy_tx_pdu) final { mac->new_grant_ul(cc_idx, grant, 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, std::move(tx_pdu));
phy->stack->new_grant_ul(0, mac_ul_grant, tx_pdu.get());
// Provisional reset and assign Tx softbuffer
srslte_softbuffer_tx_reset(&softbuffer_tx);
pusch_cfg.grant.tb[0].softbuffer.tx = &softbuffer_tx;

@ -198,14 +198,14 @@ 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, srslte::unique_byte_buffer_t phy_tx_pdu)
void mac_nr::new_grant_ul(const uint32_t cc_idx, const mac_nr_grant_ul_t& grant, srslte::byte_buffer_t* phy_tx_pdu)
{
get_ul_data(grant, std::move(phy_tx_pdu));
get_ul_data(grant, phy_tx_pdu);
metrics[cc_idx].tx_pkts++;
}
void mac_nr::get_ul_data(const mac_nr_grant_ul_t& grant, srslte::unique_byte_buffer_t phy_tx_pdu)
void mac_nr::get_ul_data(const mac_nr_grant_ul_t& grant, srslte::byte_buffer_t* phy_tx_pdu)
{
// initialize MAC PDU
tx_buffer->clear();
@ -248,8 +248,8 @@ void mac_nr::get_ul_data(const mac_nr_grant_ul_t& grant, srslte::unique_byte_buf
logger.info(tx_buffer->msg, tx_buffer->N_bytes, "Generated MAC PDU (%d B)", 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;
memcpy(phy_tx_pdu->msg, tx_buffer->msg, tx_buffer->N_bytes);
phy_tx_pdu->N_bytes = tx_buffer->N_bytes;
if (pcap) {
pcap->write_ul_crnti_nr(tx_buffer->msg, tx_buffer->N_bytes, grant.rnti, grant.pid, grant.tti);

Loading…
Cancel
Save