mirror of https://github.com/PentHertz/srsLTE.git
phy,mac,mbms: moving payload buffer from MAC to PHY to avoid thread clashes
This commit is contained in:
parent
acae2d88c6
commit
19918d9a67
|
@ -94,10 +94,7 @@ public:
|
||||||
virtual void bch_decoded_ok(uint32_t cc_idx, uint8_t* payload, uint32_t len) = 0;
|
virtual void bch_decoded_ok(uint32_t cc_idx, uint8_t* payload, uint32_t len) = 0;
|
||||||
|
|
||||||
/* Indicate successful decoding of MCH TB through PMCH */
|
/* Indicate successful decoding of MCH TB through PMCH */
|
||||||
virtual void mch_decoded(uint32_t len, bool crc) = 0;
|
virtual void mch_decoded(uint32_t len, bool crc, uint8_t* payload) = 0;
|
||||||
|
|
||||||
/* Obtain action for a new MCH subframe. */
|
|
||||||
virtual void new_mch_dl(const srsran_pdsch_grant_t& phy_grant, tb_action_dl_t* action) = 0;
|
|
||||||
|
|
||||||
/* Communicate the number of mbsfn services available */
|
/* Communicate the number of mbsfn services available */
|
||||||
virtual void set_mbsfn_config(uint32_t nof_mbsfn_services) = 0;
|
virtual void set_mbsfn_config(uint32_t nof_mbsfn_services) = 0;
|
||||||
|
|
|
@ -75,7 +75,7 @@ private:
|
||||||
mac_interface_phy_lte::tb_action_dl_t* action,
|
mac_interface_phy_lte::tb_action_dl_t* action,
|
||||||
bool acks[SRSRAN_MAX_CODEWORDS]);
|
bool acks[SRSRAN_MAX_CODEWORDS]);
|
||||||
int decode_pmch(mac_interface_phy_lte::tb_action_dl_t* action, srsran_mbsfn_cfg_t* mbsfn_cfg);
|
int decode_pmch(mac_interface_phy_lte::tb_action_dl_t* action, srsran_mbsfn_cfg_t* mbsfn_cfg);
|
||||||
|
void new_mch_dl(mac_interface_phy_lte::tb_action_dl_t*);
|
||||||
/* Methods for UL */
|
/* Methods for UL */
|
||||||
bool encode_uplink(mac_interface_phy_lte::tb_action_ul_t* action, srsran_uci_data_t* uci_data);
|
bool encode_uplink(mac_interface_phy_lte::tb_action_ul_t* action, srsran_uci_data_t* uci_data);
|
||||||
void set_uci_sr(srsran_uci_data_t* uci_data);
|
void set_uci_sr(srsran_uci_data_t* uci_data);
|
||||||
|
@ -91,11 +91,14 @@ private:
|
||||||
srsran_dl_sf_cfg_t sf_cfg_dl = {};
|
srsran_dl_sf_cfg_t sf_cfg_dl = {};
|
||||||
srsran_ul_sf_cfg_t sf_cfg_ul = {};
|
srsran_ul_sf_cfg_t sf_cfg_ul = {};
|
||||||
|
|
||||||
uint32_t cc_idx = 0;
|
uint32_t cc_idx = 0;
|
||||||
bool cell_initiated = false;
|
bool cell_initiated = false;
|
||||||
cf_t* signal_buffer_rx[SRSRAN_MAX_PORTS] = {};
|
cf_t* signal_buffer_rx[SRSRAN_MAX_PORTS] = {};
|
||||||
cf_t* signal_buffer_tx[SRSRAN_MAX_PORTS] = {};
|
cf_t* signal_buffer_tx[SRSRAN_MAX_PORTS] = {};
|
||||||
uint32_t signal_buffer_max_samples = 0;
|
uint32_t signal_buffer_max_samples = 0;
|
||||||
|
const static uint32_t mch_payload_buffer_sz = SRSRAN_MAX_BUFFER_SIZE_BYTES;
|
||||||
|
uint8_t mch_payload_buffer[mch_payload_buffer_sz];
|
||||||
|
srsran_softbuffer_rx_t mch_softbuffer;
|
||||||
|
|
||||||
/* Objects for DL */
|
/* Objects for DL */
|
||||||
srsran_ue_dl_t ue_dl = {};
|
srsran_ue_dl_t ue_dl = {};
|
||||||
|
|
|
@ -50,13 +50,12 @@ public:
|
||||||
/* see mac_interface.h for comments */
|
/* see mac_interface.h for comments */
|
||||||
void new_grant_ul(uint32_t cc_idx, mac_grant_ul_t grant, tb_action_ul_t* action);
|
void new_grant_ul(uint32_t cc_idx, mac_grant_ul_t grant, tb_action_ul_t* action);
|
||||||
void new_grant_dl(uint32_t cc_idx, mac_grant_dl_t grant, tb_action_dl_t* action);
|
void new_grant_dl(uint32_t cc_idx, mac_grant_dl_t grant, tb_action_dl_t* action);
|
||||||
void new_mch_dl(const srsran_pdsch_grant_t& phy_grant, tb_action_dl_t* action);
|
|
||||||
void tb_decoded(uint32_t cc_idx, mac_grant_dl_t grant, bool ack[SRSRAN_MAX_CODEWORDS]);
|
void tb_decoded(uint32_t cc_idx, mac_grant_dl_t grant, bool ack[SRSRAN_MAX_CODEWORDS]);
|
||||||
void bch_decoded_ok(uint32_t cc_idx, uint8_t* payload, uint32_t len);
|
void bch_decoded_ok(uint32_t cc_idx, uint8_t* payload, uint32_t len);
|
||||||
uint16_t get_dl_sched_rnti(uint32_t tti);
|
uint16_t get_dl_sched_rnti(uint32_t tti);
|
||||||
uint16_t get_ul_sched_rnti(uint32_t tti);
|
uint16_t get_ul_sched_rnti(uint32_t tti);
|
||||||
|
|
||||||
void mch_decoded(uint32_t len, bool crc);
|
void mch_decoded(uint32_t len, bool crc, uint8_t* payload);
|
||||||
void process_mch_pdu(uint32_t len);
|
void process_mch_pdu(uint32_t len);
|
||||||
|
|
||||||
void set_mbsfn_config(uint32_t nof_mbsfn_services);
|
void set_mbsfn_config(uint32_t nof_mbsfn_services);
|
||||||
|
|
|
@ -136,12 +136,7 @@ public:
|
||||||
mac.bch_decoded_ok(cc_idx, payload, len);
|
mac.bch_decoded_ok(cc_idx, payload, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
void mch_decoded(uint32_t len, bool crc) final { mac.mch_decoded(len, crc); }
|
void mch_decoded(uint32_t len, bool crc, uint8_t* payload) final { mac.mch_decoded(len, crc, payload); }
|
||||||
|
|
||||||
void new_mch_dl(const srsran_pdsch_grant_t& phy_grant, mac_interface_phy_lte::tb_action_dl_t* action) final
|
|
||||||
{
|
|
||||||
mac.new_mch_dl(phy_grant, action);
|
|
||||||
}
|
|
||||||
|
|
||||||
void set_mbsfn_config(uint32_t nof_mbsfn_services) final { mac.set_mbsfn_config(nof_mbsfn_services); }
|
void set_mbsfn_config(uint32_t nof_mbsfn_services) final { mac.set_mbsfn_config(nof_mbsfn_services); }
|
||||||
|
|
||||||
|
|
|
@ -92,6 +92,7 @@ cc_worker::cc_worker(uint32_t cc_idx_, uint32_t max_prb, srsue::phy_common* phy_
|
||||||
|
|
||||||
chest_default_cfg = ue_dl_cfg.chest_cfg;
|
chest_default_cfg = ue_dl_cfg.chest_cfg;
|
||||||
|
|
||||||
|
srsran_softbuffer_rx_init(&mch_softbuffer, 100);
|
||||||
// Set default PHY params
|
// Set default PHY params
|
||||||
reset();
|
reset();
|
||||||
|
|
||||||
|
@ -111,6 +112,7 @@ cc_worker::~cc_worker()
|
||||||
free(signal_buffer_rx[i]);
|
free(signal_buffer_rx[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
srsran_softbuffer_rx_free(&mch_softbuffer);
|
||||||
srsran_ue_dl_free(&ue_dl);
|
srsran_ue_dl_free(&ue_dl);
|
||||||
srsran_ue_ul_free(&ue_ul);
|
srsran_ue_ul_free(&ue_ul);
|
||||||
}
|
}
|
||||||
|
@ -344,12 +346,12 @@ bool cc_worker::work_dl_mbsfn(srsran_mbsfn_cfg_t mbsfn_cfg)
|
||||||
srsran_ra_dl_compute_nof_re(&cell, &sf_cfg_dl, &pmch_cfg.pdsch_cfg.grant);
|
srsran_ra_dl_compute_nof_re(&cell, &sf_cfg_dl, &pmch_cfg.pdsch_cfg.grant);
|
||||||
|
|
||||||
// Send grant to MAC and get action for this TB, then call tb_decoded to unlock MAC
|
// Send grant to MAC and get action for this TB, then call tb_decoded to unlock MAC
|
||||||
phy->stack->new_mch_dl(pmch_cfg.pdsch_cfg.grant, &dl_action);
|
new_mch_dl(&dl_action);
|
||||||
bool mch_decoded = true;
|
bool mch_decoded = true;
|
||||||
if (!decode_pmch(&dl_action, &mbsfn_cfg)) {
|
if (!decode_pmch(&dl_action, &mbsfn_cfg)) {
|
||||||
mch_decoded = false;
|
mch_decoded = false;
|
||||||
}
|
}
|
||||||
phy->stack->mch_decoded((uint32_t)pmch_cfg.pdsch_cfg.grant.tb[0].tbs / 8, mch_decoded);
|
phy->stack->mch_decoded((uint32_t)pmch_cfg.pdsch_cfg.grant.tb[0].tbs / 8, mch_decoded, mch_payload_buffer);
|
||||||
} else if (mbsfn_cfg.is_mcch) {
|
} else if (mbsfn_cfg.is_mcch) {
|
||||||
// release lock in phy_common
|
// release lock in phy_common
|
||||||
phy->set_mch_period_stop(0);
|
phy->set_mch_period_stop(0);
|
||||||
|
@ -920,5 +922,14 @@ int cc_worker::read_pdsch_d(cf_t* pdsch_d)
|
||||||
return ue_dl_cfg.cfg.pdsch.grant.nof_re;
|
return ue_dl_cfg.cfg.pdsch.grant.nof_re;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void cc_worker::new_mch_dl(mac_interface_phy_lte::tb_action_dl_t* action)
|
||||||
|
{
|
||||||
|
action->generate_ack = false;
|
||||||
|
action->tb[0].enabled = true;
|
||||||
|
action->tb[0].payload = mch_payload_buffer;
|
||||||
|
action->tb[0].softbuffer.rx = &mch_softbuffer;
|
||||||
|
srsran_softbuffer_rx_reset_cb(&mch_softbuffer, 1);
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace lte
|
} // namespace lte
|
||||||
} // namespace srsue
|
} // namespace srsue
|
||||||
|
|
|
@ -102,8 +102,7 @@ private:
|
||||||
}
|
}
|
||||||
void tb_decoded(uint32_t cc_idx, mac_grant_dl_t grant, bool* ack) override {}
|
void tb_decoded(uint32_t cc_idx, mac_grant_dl_t grant, bool* ack) override {}
|
||||||
void bch_decoded_ok(uint32_t cc_idx, uint8_t* payload, uint32_t len) override {}
|
void bch_decoded_ok(uint32_t cc_idx, uint8_t* payload, uint32_t len) override {}
|
||||||
void mch_decoded(uint32_t len, bool crc) override {}
|
void mch_decoded(uint32_t len, bool crc, uint8_t* payload) override {}
|
||||||
void new_mch_dl(const srsran_pdsch_grant_t& phy_grant, tb_action_dl_t* action) override {}
|
|
||||||
void set_mbsfn_config(uint32_t nof_mbsfn_services) override {}
|
void set_mbsfn_config(uint32_t nof_mbsfn_services) override {}
|
||||||
void run_tti(const uint32_t tti, const uint32_t tti_jump) override
|
void run_tti(const uint32_t tti, const uint32_t tti_jump) override
|
||||||
{
|
{
|
||||||
|
|
|
@ -41,7 +41,6 @@ mac::mac(const char* logname, ext_task_sched_handle task_sched_) :
|
||||||
dl_harq.at(PCELL_CC_IDX) = dl_harq_entity_ptr(new dl_harq_entity(PCELL_CC_IDX));
|
dl_harq.at(PCELL_CC_IDX) = dl_harq_entity_ptr(new dl_harq_entity(PCELL_CC_IDX));
|
||||||
|
|
||||||
srsran_softbuffer_rx_init(&pch_softbuffer, 100);
|
srsran_softbuffer_rx_init(&pch_softbuffer, 100);
|
||||||
srsran_softbuffer_rx_init(&mch_softbuffer, 100);
|
|
||||||
|
|
||||||
// Keep initialising members
|
// Keep initialising members
|
||||||
bzero(&metrics, sizeof(mac_metrics_t));
|
bzero(&metrics, sizeof(mac_metrics_t));
|
||||||
|
@ -53,7 +52,6 @@ mac::~mac()
|
||||||
stop();
|
stop();
|
||||||
|
|
||||||
srsran_softbuffer_rx_free(&pch_softbuffer);
|
srsran_softbuffer_rx_free(&pch_softbuffer);
|
||||||
srsran_softbuffer_rx_free(&mch_softbuffer);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool mac::init(phy_interface_mac_lte* phy, rlc_interface_mac* rlc, rrc_interface_mac* rrc)
|
bool mac::init(phy_interface_mac_lte* phy, rlc_interface_mac* rlc, rrc_interface_mac* rrc)
|
||||||
|
@ -324,12 +322,12 @@ void mac::bch_decoded_ok(uint32_t cc_idx, uint8_t* payload, uint32_t len)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void mac::mch_decoded(uint32_t len, bool crc)
|
void mac::mch_decoded(uint32_t len, bool crc, uint8_t* payload)
|
||||||
{
|
{
|
||||||
// Parse MAC header
|
// Parse MAC header
|
||||||
if (crc) {
|
if (crc) {
|
||||||
mch_msg.init_rx(len);
|
mch_msg.init_rx(len);
|
||||||
mch_msg.parse_packet(mch_payload_buffer);
|
mch_msg.parse_packet(payload);
|
||||||
while (mch_msg.next()) {
|
while (mch_msg.next()) {
|
||||||
for (uint32_t i = 0; i < phy_mbsfn_cfg.nof_mbsfn_services; i++) {
|
for (uint32_t i = 0; i < phy_mbsfn_cfg.nof_mbsfn_services; i++) {
|
||||||
if (srsran::mch_lcid::MCH_SCHED_INFO == mch_msg.get()->mch_ce_type()) {
|
if (srsran::mch_lcid::MCH_SCHED_INFO == mch_msg.get()->mch_ce_type()) {
|
||||||
|
@ -343,11 +341,11 @@ void mac::mch_decoded(uint32_t len, bool crc)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
demux_unit.push_pdu_mch(mch_payload_buffer, len);
|
demux_unit.push_pdu_mch(payload, len);
|
||||||
process_pdus();
|
process_pdus();
|
||||||
|
|
||||||
if (pcap) {
|
if (pcap) {
|
||||||
pcap->write_dl_mch(mch_payload_buffer, len, true, phy_h->get_current_tti(), 0);
|
pcap->write_dl_mch(payload, len, true, phy_h->get_current_tti(), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::lock_guard<std::mutex> lock(metrics_mutex);
|
std::lock_guard<std::mutex> lock(metrics_mutex);
|
||||||
|
@ -521,14 +519,6 @@ void mac::new_grant_ul(uint32_t cc_idx,
|
||||||
} // end of holding metrics mutex
|
} // end of holding metrics mutex
|
||||||
}
|
}
|
||||||
|
|
||||||
void mac::new_mch_dl(const srsran_pdsch_grant_t& phy_grant, tb_action_dl_t* action)
|
|
||||||
{
|
|
||||||
action->generate_ack = false;
|
|
||||||
action->tb[0].enabled = true;
|
|
||||||
action->tb[0].payload = mch_payload_buffer;
|
|
||||||
action->tb[0].softbuffer.rx = &mch_softbuffer;
|
|
||||||
srsran_softbuffer_rx_reset_cb(&mch_softbuffer, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
void mac::setup_timers(int time_alignment_timer)
|
void mac::setup_timers(int time_alignment_timer)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue