rrc: disable MAC bearers when RNTI gets updated

When the RRC handles the C-RNTI CE to update the RNTI, all the bearers
associated with the new RNTI (that will no longer be used) need to be disabled.
This commit implements this.

Signed-off-by: Carlo Galiotto <carlo@srs.io>
This commit is contained in:
Carlo Galiotto 2021-10-14 16:15:24 +02:00 committed by carlo-gal
parent 5f648d195c
commit fb75cbaadc
2 changed files with 25 additions and 0 deletions

View File

@ -122,6 +122,7 @@ public:
// setters
int pack_rrc_reconfiguration();
int deactivate_bearers();
private:
rrc_nr* parent = nullptr;

View File

@ -189,6 +189,8 @@ int rrc_nr::update_user(uint16_t new_rnti, uint16_t old_rnti)
// Remove new_rnti
auto new_ue_it = users.find(new_rnti);
if (new_ue_it != users.end()) {
// There is no need to check the return code, as this function should always return SUCCESS
new_ue_it->second->deactivate_bearers();
task_sched.defer_task([this, new_rnti]() { rem_user(new_rnti); });
}
@ -1496,4 +1498,26 @@ int rrc_nr::ue::add_drb()
return SRSRAN_SUCCESS;
}
/**
* @brief Deactivate all Bearers (MAC logical channel) for this specific RNTI
*
* The function iterates over the bearers or MAC logical channels and deactivates them by setting each of them to IDLE
*
* @return int SRSRAN_SUCCESS on success (only fails if the called sub-functions assert)
*/
int rrc_nr::ue::deactivate_bearers()
{
// Iterate over the bearers (MAC LC CH) and set each of them to IDLE
for (auto& ue_bearer : uecfg.ue_bearers) {
ue_bearer.direction = mac_lc_ch_cfg_t::IDLE;
}
// No need to check the returned value, as the function will return SRSRAN_SUCCESS
parent->mac->ue_cfg(rnti, uecfg);
// Technically, the only way this function fails is if parent->mac->ue_cfg(rnti, uecfg) asserts
// Should we still return SRSRAN_SUCCESS or can we make it void?
return SRSRAN_SUCCESS;
}
} // namespace srsenb