use rnti_map_t in scheduler

master
Francisco 4 years ago committed by Francisco Paisana
parent 6b84754ede
commit b54bb35343

@ -28,9 +28,20 @@ class static_circular_map
using obj_t = std::pair<K, T>;
public:
using key_type = K;
using mapped_type = T;
using value_type = std::pair<K, T>;
using difference_type = std::ptrdiff_t;
class iterator
{
public:
using iterator_category = std::forward_iterator_tag;
using value_type = std::pair<K, T>;
using difference_type = std::ptrdiff_t;
using pointer = value_type*;
using reference = value_type&;
iterator() = default;
iterator(static_circular_map<K, T, N>* map, size_t idx_) : ptr(map), idx(idx_)
{

@ -15,11 +15,11 @@
#include "sched_grid.h"
#include "sched_ue.h"
#include "srsenb/hdr/common/common_enb.h"
#include "srsran/interfaces/sched_interface.h"
#include <atomic>
#include <map>
#include <mutex>
#include <queue>
namespace srsenb {
@ -91,7 +91,7 @@ protected:
sched_args_t sched_cfg = {};
std::vector<sched_cell_params_t> sched_cell_params;
std::map<uint16_t, std::unique_ptr<sched_ue> > ue_db;
rnti_map_t<std::unique_ptr<sched_ue> > ue_db;
// independent schedulers for each carrier
std::vector<std::unique_ptr<carrier_sched> > carrier_schedulers;

@ -27,7 +27,7 @@ class sched::carrier_sched
{
public:
explicit carrier_sched(rrc_interface_mac* rrc_,
std::map<uint16_t, std::unique_ptr<sched_ue> >* ue_db_,
sched_ue_list* ue_db_,
uint32_t enb_cc_idx_,
sched_result_ringbuffer* sched_results_);
~carrier_sched();
@ -54,7 +54,7 @@ private:
const sched_cell_params_t* cc_cfg = nullptr;
srslog::basic_logger& logger;
rrc_interface_mac* rrc = nullptr;
std::map<uint16_t, std::unique_ptr<sched_ue> >* ue_db = nullptr;
sched_ue_list* ue_db = nullptr;
const uint32_t enb_cc_idx;
// Subframe scheduling logic

@ -14,15 +14,14 @@
#define SRSENB_SCHEDULER_UE_H
#include "sched_common.h"
#include "srsran/srslog/srslog.h"
#include <map>
#include <vector>
#include "sched_ue_ctrl/sched_lch.h"
#include "sched_ue_ctrl/sched_ue_cell.h"
#include "sched_ue_ctrl/tpc.h"
#include "srsenb/hdr/common/common_enb.h"
#include "srsran/srslog/srslog.h"
#include <bitset>
#include <deque>
#include <map>
#include <vector>
namespace srsenb {
@ -211,7 +210,7 @@ private:
std::vector<sched_ue_cell> cells; ///< List of eNB cells that may be configured/activated/deactivated for the UE
};
using sched_ue_list = std::map<uint16_t, std::unique_ptr<sched_ue> >;
using sched_ue_list = rnti_map_t<std::unique_ptr<sched_ue> >;
} // namespace srsenb

@ -107,14 +107,14 @@ int sched::ue_cfg(uint16_t rnti, const sched_interface::ue_cfg_t& ue_cfg)
// Add new user case
std::unique_ptr<sched_ue> ue{new sched_ue(rnti, sched_cell_params, ue_cfg)};
std::lock_guard<std::mutex> lock(sched_mutex);
ue_db.insert(std::make_pair(rnti, std::move(ue)));
ue_db.insert(rnti, std::move(ue));
return SRSRAN_SUCCESS;
}
int sched::ue_rem(uint16_t rnti)
{
std::lock_guard<std::mutex> lock(sched_mutex);
if (ue_db.count(rnti) > 0) {
if (ue_db.contains(rnti)) {
ue_db.erase(rnti);
} else {
Error("User rnti=0x%x not found", rnti);

@ -38,7 +38,7 @@ void sched_time_pf::new_tti(sched_ue_list& ue_db, sf_sched* tti_sched)
current_tti_rx = tti_point{tti_sched->get_tti_rx()};
// remove deleted users from history
for (auto it = ue_history_db.begin(); it != ue_history_db.end();) {
if (not ue_db.count(it->first)) {
if (not ue_db.contains(it->first)) {
it = ue_history_db.erase(it);
} else {
++it;

Loading…
Cancel
Save