when the rrc fails to allocate the ue cell resources, it should erase the ue from all stack layers

master
Francisco Paisana 4 years ago
parent eb515c5205
commit 9c7c190074

@ -400,7 +400,7 @@ class rrc_interface_mac
{ {
public: public:
/* Radio Link failure */ /* Radio Link failure */
virtual void add_user(uint16_t rnti, const sched_interface::ue_cfg_t& init_ue_cfg) = 0; virtual int add_user(uint16_t rnti, const sched_interface::ue_cfg_t& init_ue_cfg) = 0;
virtual void upd_user(uint16_t new_rnti, uint16_t old_rnti) = 0; virtual void upd_user(uint16_t new_rnti, uint16_t old_rnti) = 0;
virtual void set_activity_user(uint16_t rnti) = 0; virtual void set_activity_user(uint16_t rnti) = 0;
virtual bool is_paging_opportunity(uint32_t tti, uint32_t* payload_len) = 0; virtual bool is_paging_opportunity(uint32_t tti, uint32_t* payload_len) = 0;

@ -61,7 +61,7 @@ public:
void tti_clock(); void tti_clock();
// rrc_interface_mac // rrc_interface_mac
void add_user(uint16_t rnti, const sched_interface::ue_cfg_t& init_ue_cfg) override; int add_user(uint16_t rnti, const sched_interface::ue_cfg_t& init_ue_cfg) override;
void upd_user(uint16_t new_rnti, uint16_t old_rnti) override; void upd_user(uint16_t new_rnti, uint16_t old_rnti) override;
void set_activity_user(uint16_t rnti) override; void set_activity_user(uint16_t rnti) override;
bool is_paging_opportunity(uint32_t tti, uint32_t* payload_len) override; bool is_paging_opportunity(uint32_t tti, uint32_t* payload_len) override;

@ -25,6 +25,7 @@ public:
ue(rrc* outer_rrc, uint16_t rnti, const sched_interface::ue_cfg_t& ue_cfg); ue(rrc* outer_rrc, uint16_t rnti, const sched_interface::ue_cfg_t& ue_cfg);
~ue(); ~ue();
int init();
bool is_connected(); bool is_connected();
bool is_idle(); bool is_idle();

@ -525,11 +525,15 @@ void mac::rach_detected(uint32_t tti, uint32_t enb_cc_idx, uint32_t preamble_idx
ue_cfg.supported_cc_list[0].dl_cfg.tm = SRSLTE_TM1; ue_cfg.supported_cc_list[0].dl_cfg.tm = SRSLTE_TM1;
if (scheduler.ue_cfg(rnti, ue_cfg) != SRSLTE_SUCCESS) { if (scheduler.ue_cfg(rnti, ue_cfg) != SRSLTE_SUCCESS) {
Error("Registering new user rnti=0x%x to SCHED\n", rnti); Error("Registering new user rnti=0x%x to SCHED\n", rnti);
ue_rem(rnti);
return; return;
} }
// Register new user in RRC // Register new user in RRC
rrc_h->add_user(rnti, ue_cfg); if (rrc_h->add_user(rnti, ue_cfg) == SRSLTE_ERROR) {
ue_rem(rnti);
return;
}
// Trigger scheduler RACH // Trigger scheduler RACH
scheduler.dl_rach_info(enb_cc_idx, rar_info); scheduler.dl_rach_info(enb_cc_idx, rar_info);

@ -144,27 +144,25 @@ uint32_t rrc::get_nof_users()
void rrc::max_retx_attempted(uint16_t rnti) {} void rrc::max_retx_attempted(uint16_t rnti) {}
// This function is called from PRACH worker (can wait) // This function is called from PRACH worker (can wait)
void rrc::add_user(uint16_t rnti, const sched_interface::ue_cfg_t& sched_ue_cfg) int rrc::add_user(uint16_t rnti, const sched_interface::ue_cfg_t& sched_ue_cfg)
{ {
auto user_it = users.find(rnti); auto user_it = users.find(rnti);
if (user_it == users.end()) { if (user_it == users.end()) {
bool rnti_added = true;
if (rnti != SRSLTE_MRNTI) { if (rnti != SRSLTE_MRNTI) {
// only non-eMBMS RNTIs are present in user map // only non-eMBMS RNTIs are present in user map
auto p = users.insert(std::make_pair(rnti, std::unique_ptr<ue>{new ue(this, rnti, sched_ue_cfg)})); std::unique_ptr<ue> u{new ue(this, rnti, sched_ue_cfg)};
if (not u->init()) {
rrc_log->error("Adding user rnti=0x%x - Failed to allocate user resources\n", rnti);
return SRSLTE_ERROR;
}
if (ue_pool.capacity() <= 4) { if (ue_pool.capacity() <= 4) {
task_sched.defer_task([]() { rrc::ue_pool.reserve(16); }); task_sched.defer_task([]() { rrc::ue_pool.reserve(16); });
} }
rnti_added = p.second and p.first->second->is_allocated(); users.insert(std::make_pair(rnti, std::move(u)));
} }
if (rnti_added) {
rlc->add_user(rnti); rlc->add_user(rnti);
pdcp->add_user(rnti); pdcp->add_user(rnti);
rrc_log->info("Added new user rnti=0x%x\n", rnti); rrc_log->info("Added new user rnti=0x%x\n", rnti);
} else {
mac->bearer_ue_rem(rnti, 0);
rrc_log->error("Adding user rnti=0x%x - Failed to allocate user resources\n", rnti);
}
} else { } else {
rrc_log->error("Adding user rnti=0x%x (already exists)\n", rnti); rrc_log->error("Adding user rnti=0x%x (already exists)\n", rnti);
} }
@ -181,6 +179,7 @@ void rrc::add_user(uint16_t rnti, const sched_interface::ue_cfg_t& sched_ue_cfg)
teid_in = gtpu->add_bearer(SRSLTE_MRNTI, lcid, 1, 1); teid_in = gtpu->add_bearer(SRSLTE_MRNTI, lcid, 1, 1);
} }
} }
return SRSLTE_SUCCESS;
} }
/* Function called by MAC after the reception of a C-RNTI CE indicating that the UE still has a /* Function called by MAC after the reception of a C-RNTI CE indicating that the UE still has a

@ -39,24 +39,27 @@ rrc::ue::ue(rrc* outer_rrc, uint16_t rnti_, const sched_interface::ue_cfg_t& sch
bearer_list(rnti_, parent->cfg), bearer_list(rnti_, parent->cfg),
ue_security_cfg(parent->cfg), ue_security_cfg(parent->cfg),
mac_ctrl(rnti, ue_cell_list, bearer_list, parent->cfg, parent->mac, *parent->cell_common_list, sched_ue_cfg) mac_ctrl(rnti, ue_cell_list, bearer_list, parent->cfg, parent->mac, *parent->cell_common_list, sched_ue_cfg)
{ {}
rrc::ue::~ue() {}
int rrc::ue::init()
{
// Allocate cell and PUCCH resources // Allocate cell and PUCCH resources
if (ue_cell_list.add_cell(sched_ue_cfg.supported_cc_list[0].enb_cc_idx) == nullptr) { if (ue_cell_list.add_cell(mac_ctrl.get_ue_sched_cfg().supported_cc_list[0].enb_cc_idx) == nullptr) {
return; return SRSLTE_ERROR;
} }
// Configure // Configure
apply_setup_phy_common(parent->cfg.sibs[1].sib2().rr_cfg_common, true); apply_setup_phy_common(parent->cfg.sibs[1].sib2().rr_cfg_common, true);
activity_timer = outer_rrc->task_sched.get_unique_timer(); activity_timer = parent->task_sched.get_unique_timer();
set_activity_timeout(MSG3_RX_TIMEOUT); // next UE response is Msg3 set_activity_timeout(MSG3_RX_TIMEOUT); // next UE response is Msg3
mobility_handler.reset(new rrc_mobility(this)); mobility_handler.reset(new rrc_mobility(this));
return SRSLTE_SUCCESS;
} }
rrc::ue::~ue() {}
void* rrc::ue::operator new(size_t sz) void* rrc::ue::operator new(size_t sz)
{ {
assert(sz == sizeof(ue)); assert(sz == sizeof(ue));

Loading…
Cancel
Save