diff --git a/srsenb/src/phy/cc_worker.cc b/srsenb/src/phy/cc_worker.cc index 62f1648e5..90a45c558 100644 --- a/srsenb/src/phy/cc_worker.cc +++ b/srsenb/src/phy/cc_worker.cc @@ -658,8 +658,10 @@ int cc_worker::encode_pmch(stack_interface_phy_lte::dl_sched_grant_t* grant, srs // Logging char str[512]; srslte_pdsch_tx_info(&pmch_cfg.pdsch_cfg, str, 512); - Info("pmch: %s\n", str); + Info("PMCH: %s\n", str); + // Save metrics stats + ue_db[SRSLTE_MRNTI]->metrics_dl(mbsfn_cfg->mbsfn_mcs); return SRSLTE_SUCCESS; } @@ -728,7 +730,8 @@ uint32_t cc_worker::get_metrics(phy_metrics_t metrics[ENB_METRICS_MAX_USERS]) std::lock_guard lock(mutex); uint32_t cnt = 0; for (auto& ue : ue_db) { - if (SRSLTE_RNTI_ISUSER(ue.first) && cnt < ENB_METRICS_MAX_USERS) { + if ((SRSLTE_RNTI_ISUSER(ue.first) || ue.first == SRSLTE_MRNTI) && + cnt < ENB_METRICS_MAX_USERS) { ue.second->metrics_read(&metrics[cnt]); cnt++; } diff --git a/srsenb/src/stack/mac/mac.cc b/srsenb/src/stack/mac/mac.cc index b4c56b59a..a643c677f 100644 --- a/srsenb/src/stack/mac/mac.cc +++ b/srsenb/src/stack/mac/mac.cc @@ -216,7 +216,7 @@ int mac::ue_cfg(uint16_t rnti, sched_interface::ue_cfg_t* cfg) } // Update Scheduler configuration - if (scheduler.ue_cfg(rnti, cfg)) { + if ((cfg != NULL) ? scheduler.ue_cfg(rnti, cfg) : false) { Error("Registering new UE rnti=0x%x to SCHED\n", rnti); } else { ret = 0; @@ -267,10 +267,8 @@ void mac::get_metrics(mac_metrics_t metrics[ENB_METRICS_MAX_USERS]) pthread_rwlock_rdlock(&rwlock); int cnt = 0; for (auto& u : ue_db) { - if (u.first != SRSLTE_MRNTI) { - u.second->metrics_read(&metrics[cnt]); - cnt++; - } + u.second->metrics_read(&metrics[cnt]); + cnt++; } pthread_rwlock_unlock(&rwlock); } @@ -698,6 +696,7 @@ int mac::get_mch_sched(uint32_t tti, bool is_mcch, dl_sched_t* dl_sched_res) dl_sched_res->pdsch[0].dci.rnti = SRSLTE_MRNTI; // we use TTI % HARQ to make sure we use different buffers for consecutive TTIs to avoid races between PHY workers + ue_db[SRSLTE_MRNTI]->metrics_tx(true, mcs.tbs); dl_sched_res->pdsch[0].data[0] = ue_db[SRSLTE_MRNTI]->generate_mch_pdu(tti % SRSLTE_FDD_NOF_HARQ, mch, mch.num_mtch_sched + 1, mcs.tbs / 8); @@ -723,6 +722,7 @@ int mac::get_mch_sched(uint32_t tti, bool is_mcch, dl_sched_t* dl_sched_res) mch.mtch_sched[0].mtch_payload = mtch_payload_buffer; dl_sched_res->pdsch[0].dci.rnti = SRSLTE_MRNTI; if (bytes_received) { + ue_db[SRSLTE_MRNTI]->metrics_tx(true, mcs.tbs); dl_sched_res->pdsch[0].data[0] = ue_db[SRSLTE_MRNTI]->generate_mch_pdu(tti % SRSLTE_FDD_NOF_HARQ, mch, 1, mcs_data.tbs / 8); } diff --git a/srsenb/src/stack/rrc/rrc.cc b/srsenb/src/stack/rrc/rrc.cc index 7318c13bd..20373541a 100644 --- a/srsenb/src/stack/rrc/rrc.cc +++ b/srsenb/src/stack/rrc/rrc.cc @@ -126,9 +126,7 @@ void rrc::get_metrics(rrc_metrics_t& m) m.n_ues = 0; for (auto iter = users.begin(); m.n_ues < ENB_METRICS_MAX_USERS && iter != users.end(); ++iter) { ue* u = iter->second.get(); - if (iter->first != SRSLTE_MRNTI) { - m.ues[m.n_ues++].state = u->get_state(); - } + m.ues[m.n_ues++].state = u->get_state(); } pthread_mutex_unlock(&user_mutex); } @@ -214,6 +212,9 @@ void rrc::add_user(uint16_t rnti) uint32_t teid_in = 1; for (auto& mbms_item : mcch.msg.c1().mbsfn_area_cfg_r9().pmch_info_list_r9[0].mbms_session_info_list_r9) { uint32_t lcid = mbms_item.lc_ch_id_r9; + + // adding UE object to MAC for MRNTI without scheduling configuration (broadcast not part of regular scheduling) + mac->ue_cfg(SRSLTE_MRNTI, NULL); rlc->add_bearer_mrb(SRSLTE_MRNTI, lcid); pdcp->add_bearer(SRSLTE_MRNTI, lcid, srslte::make_drb_pdcp_config_t(1, false)); gtpu->add_bearer(SRSLTE_MRNTI, lcid, 1, 1, &teid_in); diff --git a/srsenb/src/stack/upper/gtpu.cc b/srsenb/src/stack/upper/gtpu.cc index 7c0f2eb23..a30e27f6a 100644 --- a/srsenb/src/stack/upper/gtpu.cc +++ b/srsenb/src/stack/upper/gtpu.cc @@ -338,7 +338,7 @@ void gtpu::m1u_handler::handle_rx_packet(srslte::unique_byte_buffer_t pdu, const gtpu_header_t header; gtpu_read_header(pdu.get(), &header, gtpu_log); - pdcp->write_sdu(SRSLTE_MRNTI, lcid_counter++, std::move(pdu)); + pdcp->write_sdu(SRSLTE_MRNTI, lcid_counter, std::move(pdu)); } } // namespace srsenb