Allocate PUCCH resources on ConnectionRequest and send ConnectionReject if not available

master
Ismael Gomez 3 years ago
parent 6e18bd1c71
commit 3bbf173149

@ -127,8 +127,9 @@ public:
const enb_cell_common_list& enb_common_list);
~ue_cell_ded_list();
ue_cell_ded* add_cell(uint32_t enb_cc_idx);
ue_cell_ded* add_cell(uint32_t enb_cc_idx, bool init_pucch = true);
bool rem_last_cell();
bool init_pucch_pcell();
bool set_cells(const std::vector<uint32_t>& enb_cc_idxs);
ue_cell_ded* get_ue_cc_idx(uint32_t ue_cc_idx) { return (ue_cc_idx < nof_cells()) ? &cell_list[ue_cc_idx] : nullptr; }

@ -51,6 +51,9 @@ public:
void protocol_failure();
void deactivate_bearers() { mac_ctrl.set_radio_bearer_state(mac_lc_ch_cfg_t::IDLE); }
// Init PUCCH resources for PCell
bool init_pucch();
rrc_state_t get_state();
void get_metrics(rrc_ue_metrics_t& ue_metrics) const;

@ -170,7 +170,7 @@ const ue_cell_ded* ue_cell_ded_list::find_cell(uint32_t earfcn, uint32_t pci) co
return it == cell_list.end() ? nullptr : &(*it);
}
ue_cell_ded* ue_cell_ded_list::add_cell(uint32_t enb_cc_idx)
ue_cell_ded* ue_cell_ded_list::add_cell(uint32_t enb_cc_idx, bool init_pucch)
{
const enb_cell_common* cell_common = common_list.get_cc_idx(enb_cc_idx);
if (cell_common == nullptr) {
@ -193,10 +193,12 @@ ue_cell_ded* ue_cell_ded_list::add_cell(uint32_t enb_cc_idx)
cell_list.emplace_back(cell_list.size(), *cell_common);
// Allocate CQI, SR, and PUCCH CS resources. If failure, do not add new cell
if (init_pucch) {
if (not alloc_cell_resources(ue_cc_idx)) {
rem_last_cell();
return nullptr;
}
}
return &cell_list.back();
}
@ -216,6 +218,17 @@ bool ue_cell_ded_list::rem_last_cell()
return true;
}
bool ue_cell_ded_list::init_pucch_pcell()
{
if (not alloc_cell_resources(UE_PCELL_CC_IDX)) {
dealloc_sr_resources();
dealloc_pucch_cs_resources();
dealloc_cqi_resources(UE_PCELL_CC_IDX);
return false;
}
return true;
}
bool ue_cell_ded_list::alloc_cell_resources(uint32_t ue_cc_idx)
{
const uint32_t meas_gap_duration = 6;
@ -265,7 +278,7 @@ bool ue_cell_ded_list::alloc_cell_resources(uint32_t ue_cc_idx)
}
}
if (not alloc_cqi_resources(ue_cc_idx, cfg.cqi_cfg.period)) {
logger.error("Failed to allocate CQIresources for cell ue_cc_idx=%d", ue_cc_idx);
logger.error("Failed to allocate CQI resources for cell ue_cc_idx=%d", ue_cc_idx);
return false;
}

@ -171,9 +171,20 @@ uint16_t rrc::start_ho_ue_resource_alloc(const asn1::s1ap::ho_request_s&
}
// Register new user in RRC
add_user(rnti, ue_cfg);
if (add_user(rnti, ue_cfg) != SRSRAN_SUCCESS) {
logger.error("Failed to create user");
cause.set_radio_network().value = asn1::s1ap::cause_radio_network_opts::no_radio_res_available_in_target_cell;
return SRSRAN_INVALID_RNTI;
}
auto it = users.find(rnti);
ue* ue_ptr = it->second.get();
if (not ue_ptr->init_pucch()) {
rem_user(rnti);
logger.warning("Failed to allocate PUCCH resources for rnti=0x%x", rnti);
cause.set_radio_network().value = asn1::s1ap::cause_radio_network_opts::no_radio_res_available_in_target_cell;
return SRSRAN_INVALID_RNTI;
}
// Reset activity timer (Response is not expected)
ue_ptr->set_activity_timeout(ue::UE_INACTIVITY_TIMEOUT);
ue_ptr->set_activity(false);

@ -47,10 +47,16 @@ rrc::ue::ue(rrc* outer_rrc, uint16_t rnti_, const sched_interface::ue_cfg_t& sch
rrc::ue::~ue() {}
bool rrc::ue::init_pucch()
{
// Allocate PUCCH resources for PCell
return ue_cell_list.init_pucch_pcell();
}
int rrc::ue::init()
{
// Allocate cell and PUCCH resources
if (ue_cell_list.add_cell(mac_ctrl.get_ue_sched_cfg().supported_cc_list[0].enb_cc_idx) == nullptr) {
// Allocate cell (PUCCH resources are not allocated here)
if (ue_cell_list.add_cell(mac_ctrl.get_ue_sched_cfg().supported_cc_list[0].enb_cc_idx, false) == nullptr) {
return SRSRAN_ERROR;
}
@ -436,6 +442,13 @@ void rrc::ue::handle_rrc_con_req(rrc_conn_request_s* msg)
return;
}
// Allocate PUCCH resources and reject if not available
if (not init_pucch()) {
parent->logger.warning("Could not allocate PUCCH resources for rnti=0x%x. Sending Connection Reject", rnti);
send_connection_reject(procedure_result_code::fail_in_radio_interface_proc);
return;
}
rrc_conn_request_r8_ies_s* msg_r8 = &msg->crit_exts.rrc_conn_request_r8();
if (msg_r8->ue_id.type() == init_ue_id_c::types::s_tmsi) {

Loading…
Cancel
Save