diff --git a/srsenb/hdr/stack/mac/common/mac_metrics.h b/srsenb/hdr/stack/mac/common/mac_metrics.h index cf8352ec4..61a5aca78 100644 --- a/srsenb/hdr/stack/mac/common/mac_metrics.h +++ b/srsenb/hdr/stack/mac/common/mac_metrics.h @@ -37,10 +37,18 @@ struct mac_ue_metrics_t { float phr; }; +/// MAC misc information for each cc. +struct mac_cc_info_t { + /// PCI value. + uint32_t pci; + /// RACH preamble counter per cc. + uint32_t cc_rach_counter; +}; + /// Main MAC metrics. struct mac_metrics_t { - /// RACH preamble counter per cc. - std::vector cc_rach_counter; + /// Per CC info. + std::vector cc_info; /// Per UE MAC metrics. std::vector ues; }; diff --git a/srsenb/src/metrics_json.cc b/srsenb/src/metrics_json.cc index eb97a7f4f..3b955be9b 100644 --- a/srsenb/src/metrics_json.cc +++ b/srsenb/src/metrics_json.cc @@ -70,19 +70,20 @@ DECLARE_METRIC_SET("ue_container", metric_bsr, mlist_bearers); -/// Sector container metrics. +/// Cell container metrics. DECLARE_METRIC("sector_id", metric_sector_id, uint32_t, ""); -DECLARE_METRIC("sector_rach", metric_sector_rach, uint32_t, ""); +DECLARE_METRIC("pci", metric_pci, uint32_t, ""); +DECLARE_METRIC("nof_rach", metric_nof_rach, uint32_t, ""); DECLARE_METRIC_LIST("ue_list", mlist_ues, std::vector); -DECLARE_METRIC_SET("sector_container", mset_sector_container, metric_sector_id, metric_sector_rach, mlist_ues); +DECLARE_METRIC_SET("cell_container", mset_cell_container, metric_sector_id, metric_pci, metric_nof_rach, mlist_ues); /// Metrics root object. DECLARE_METRIC("type", metric_type_tag, std::string, ""); DECLARE_METRIC("timestamp", metric_timestamp_tag, double, ""); -DECLARE_METRIC_LIST("sector_list", mlist_sector, std::vector); +DECLARE_METRIC_LIST("cell_list", mlist_cell, std::vector); /// Metrics context. -using metric_context_t = srslog::build_context_type; +using metric_context_t = srslog::build_context_type; } // namespace @@ -170,7 +171,7 @@ void metrics_json::set_metrics(const enb_metrics_t& m, const uint32_t period_use if (!enb) { return; } - if (m.stack.mac.cc_rach_counter.empty()) { + if (m.stack.mac.cc_info.empty()) { return; } @@ -178,27 +179,28 @@ void metrics_json::set_metrics(const enb_metrics_t& m, const uint32_t period_use // Fill root object. ctx.write("metrics"); - auto& sector_list = ctx.get(); - sector_list.resize(m.stack.mac.cc_rach_counter.size()); + auto& cell_list = ctx.get(); + cell_list.resize(m.stack.mac.cc_info.size()); - // For each sector... - for (unsigned cc_idx = 0, e = sector_list.size(); cc_idx != e; ++cc_idx) { - auto& sector = sector_list[cc_idx]; - sector.write(cc_idx); - sector.write(m.stack.mac.cc_rach_counter[cc_idx]); + // For each cell... + for (unsigned cc_idx = 0, e = cell_list.size(); cc_idx != e; ++cc_idx) { + auto& cell = cell_list[cc_idx]; + cell.write(cc_idx); + cell.write(m.stack.mac.cc_info[cc_idx].cc_rach_counter); + cell.write(m.stack.mac.cc_info[cc_idx].pci); - // For each UE in this sector... + // For each UE in this cell... for (unsigned i = 0; i != m.stack.rrc.ues.size(); ++i) { if (!has_valid_metric_ranges(m, i)) { continue; } - // Only record UEs that belong to this sector. + // Only record UEs that belong to this cell. if (m.stack.mac.ues[i].cc_idx != cc_idx) { continue; } - sector.get().emplace_back(); - fill_ue_metrics(sector.get().back(), m, i); + cell.get().emplace_back(); + fill_ue_metrics(cell.get().back(), m, i); } } diff --git a/srsenb/src/stack/mac/mac.cc b/srsenb/src/stack/mac/mac.cc index aee82af20..8e66ef59d 100644 --- a/srsenb/src/stack/mac/mac.cc +++ b/srsenb/src/stack/mac/mac.cc @@ -244,7 +244,11 @@ void mac::get_metrics(mac_metrics_t& metrics) metrics.ues.emplace_back(); u.second->metrics_read(&metrics.ues.back()); } - metrics.cc_rach_counter = detected_rachs; + metrics.cc_info.resize(detected_rachs.size()); + for (unsigned cc = 0, e = detected_rachs.size(); cc != e; ++cc) { + metrics.cc_info[cc].cc_rach_counter = detected_rachs[cc]; + metrics.cc_info[cc].pci = (cc < cell_config.size()) ? cell_config[cc].cell.id : 0; + } } void mac::toggle_padding() @@ -828,9 +832,9 @@ int mac::get_mch_sched(uint32_t tti, bool is_mcch, dl_sched_list_t& dl_sched_res int requested_bytes = (mcs_data.tbs / 8 > (int)mch.mtch_sched[mtch_index].lcid_buffer_size) ? (mch.mtch_sched[mtch_index].lcid_buffer_size) : ((mcs_data.tbs / 8) - 2); - int bytes_received = ue_db[SRSRAN_MRNTI]->read_pdu(current_lcid, mtch_payload_buffer, requested_bytes); - mch.pdu[0].lcid = current_lcid; - mch.pdu[0].nbytes = bytes_received; + int bytes_received = ue_db[SRSRAN_MRNTI]->read_pdu(current_lcid, mtch_payload_buffer, requested_bytes); + mch.pdu[0].lcid = current_lcid; + mch.pdu[0].nbytes = bytes_received; mch.mtch_sched[0].mtch_payload = mtch_payload_buffer; dl_sched_res->pdsch[0].dci.rnti = SRSRAN_MRNTI; if (bytes_received) { diff --git a/srsenb/src/stack/rrc/rrc.cc b/srsenb/src/stack/rrc/rrc.cc index 280464e67..bc61d1bd5 100644 --- a/srsenb/src/stack/rrc/rrc.cc +++ b/srsenb/src/stack/rrc/rrc.cc @@ -712,7 +712,8 @@ void rrc::config_mac() logger.info("Allocating %d PRBs for PUCCH", item.nrb_pucch); // Copy base cell configuration - item.cell = cfg.cell; + item.cell = cfg.cell; + item.cell.id = cfg.cell_list[ccidx].pci; // copy secondary cell list info sched_cfg[ccidx].scell_list.reserve(cfg.cell_list[ccidx].scell_list.size());