ue,rrc: handle DRB removal correctly

when RRC receives a command to remove a DRB, it also needs to delete
the bearer at RLC and PDCP
This commit is contained in:
Andre Puschmann 2021-09-06 12:48:37 +02:00
parent f7e943b6b6
commit 5a936d9940
2 changed files with 28 additions and 0 deletions

View File

@ -383,6 +383,7 @@ private:
void add_srb(const asn1::rrc::srb_to_add_mod_s& srb_cnfg);
void add_drb(const asn1::rrc::drb_to_add_mod_s& drb_cnfg);
void release_drb(uint32_t drb_id);
uint32_t get_lcid_for_drb_id(const uint32_t& drb_id);
uint32_t get_lcid_for_eps_bearer(const uint32_t& eps_bearer_id);
uint32_t get_drb_id_for_eps_bearer(const uint32_t& eps_bearer_id);
uint32_t get_eps_bearer_id_for_drb_id(const uint32_t& drb_id);

View File

@ -2756,6 +2756,13 @@ void rrc::release_drb(uint32_t drb_id)
{
if (drbs.find(drb_id) != drbs.end()) {
logger.info("Releasing DRB Id %d", drb_id);
// remvove RLC and PDCP for this LCID
uint32_t lcid = get_lcid_for_drb_id(drb_id);
rlc->del_bearer(lcid);
pdcp->del_bearer(lcid);
// TODO: implement bearer removal at MAC
// remove EPS bearer associated with this DRB from Stack (GW will trigger service request if needed)
stack->remove_eps_bearer(get_eps_bearer_id_for_drb_id(drb_id));
drbs.erase(drb_id);
@ -2764,6 +2771,26 @@ void rrc::release_drb(uint32_t drb_id)
}
}
/**
* @brief check if this DRB id exists and return it's LCID
*
* if the DRB couldn't be found, 0 is returned. This is an invalid
* LCID for DRB and the caller should handle it.
*/
uint32_t rrc::get_lcid_for_drb_id(const uint32_t& drb_id)
{
uint32_t lcid = 0;
if (drbs.find(drb_id) != drbs.end()) {
asn1::rrc::drb_to_add_mod_s drb_cnfg = drbs[drb_id];
if (drb_cnfg.lc_ch_id_present) {
lcid = drb_cnfg.lc_ch_id;
} else {
lcid = srsran::MAX_LTE_SRB_ID + drb_cnfg.drb_id;
}
}
return lcid;
}
uint32_t rrc::get_lcid_for_eps_bearer(const uint32_t& eps_bearer_id)
{
// check if this bearer id exists and return it's LCID