Skip to content

Commit e27ba38

Browse files
committed
fix conversions of drb id to erab id in srsenb
1 parent d81788e commit e27ba38

File tree

3 files changed

+20
-14
lines changed

3 files changed

+20
-14
lines changed

srsenb/hdr/common/common_enb.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ constexpr uint32_t drb_to_lcid(lte_drb drb_id)
5151
{
5252
return srb_to_lcid(lte_srb::srb2) + static_cast<uint32_t>(drb_id);
5353
}
54+
constexpr lte_drb lte_lcid_to_drb(uint32_t lcid)
55+
{
56+
return srsran::is_lte_drb(lcid) ? static_cast<lte_drb>(lcid - srb_to_lcid(lte_srb::srb2)) : lte_drb::invalid;
57+
}
5458

5559
// Cat 3 UE - Max number of DL-SCH transport block bits received within a TTI
5660
// 3GPP 36.306 Table 4.1.1

srsenb/src/stack/rrc/rrc_bearer_cfg.cc

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -336,9 +336,8 @@ int bearer_cfg_handler::release_erab(uint8_t erab_id)
336336
return SRSRAN_ERROR;
337337
}
338338

339-
uint8_t drb_id = erab_id - 4;
340-
341-
srsran::rem_rrc_obj_id(current_drbs, drb_id);
339+
lte_drb drb_id = lte_lcid_to_drb(it->second.lcid);
340+
srsran::rem_rrc_obj_id(current_drbs, (uint8_t)drb_id);
342341

343342
rem_gtpu_bearer(erab_id);
344343

@@ -438,16 +437,19 @@ void bearer_cfg_handler::fill_pending_nas_info(asn1::rrc::rrc_conn_recfg_r8_ies_
438437
// Add E-RAB info message for the E-RABs
439438
if (msg->rr_cfg_ded.drb_to_add_mod_list_present) {
440439
for (const drb_to_add_mod_s& drb : msg->rr_cfg_ded.drb_to_add_mod_list) {
441-
uint8_t erab_id = drb.drb_id + 4;
442-
auto it = erab_info_list.find(erab_id);
443-
if (it != erab_info_list.end()) {
444-
const std::vector<uint8_t>& erab_info = it->second;
440+
uint32_t lcid = drb_to_lcid((lte_drb)drb.drb_id);
441+
auto erab_it = std::find_if(
442+
erabs.begin(), erabs.end(), [lcid](const std::pair<uint8_t, erab_t>& e) { return e.second.lcid == lcid; });
443+
uint32_t erab_id = erab_it->second.id;
444+
auto info_it = erab_info_list.find(erab_id);
445+
if (info_it != erab_info_list.end()) {
446+
const std::vector<uint8_t>& erab_info = info_it->second;
445447
logger->info(&erab_info[0], erab_info.size(), "connection_reconf erab_info -> nas_info rnti 0x%x", rnti);
446448
msg->ded_info_nas_list[idx].resize(erab_info.size());
447449
memcpy(msg->ded_info_nas_list[idx].data(), &erab_info[0], erab_info.size());
448-
erab_info_list.erase(it);
450+
erab_info_list.erase(info_it);
449451
} else {
450-
logger->debug("Not adding NAS message to connection reconfiguration. E-RAB id %d", erab_id);
452+
logger->info("Not adding NAS message to connection reconfiguration. E-RAB id %d", erab_id);
451453
}
452454
idx++;
453455
}

srsenb/src/stack/rrc/rrc_mobility.cc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -997,12 +997,12 @@ void rrc::ue::rrc_mobility::handle_status_transfer(s1_target_ho_st& s, const sta
997997
logger.warning("The E-RAB Id=%d is not recognized", erab_item.erab_id);
998998
continue;
999999
}
1000-
const auto& drbs = rrc_ue->bearer_list.get_established_drbs();
1001-
uint8_t drbid = erab_item.erab_id - 4;
1002-
auto drb_it =
1003-
std::find_if(drbs.begin(), drbs.end(), [drbid](const drb_to_add_mod_s& drb) { return drb.drb_id == drbid; });
1000+
const auto& drbs = rrc_ue->bearer_list.get_established_drbs();
1001+
lte_drb drbid = lte_lcid_to_drb(erab_it->second.lcid);
1002+
auto drb_it = std::find_if(
1003+
drbs.begin(), drbs.end(), [drbid](const drb_to_add_mod_s& drb) { return (lte_drb)drb.drb_id == drbid; });
10041004
if (drb_it == drbs.end()) {
1005-
logger.warning("The DRB id=%d does not exist", erab_item.erab_id - 4);
1005+
logger.warning("The DRB id=%d does not exist", (int)drbid);
10061006
}
10071007

10081008
srsran::pdcp_lte_state_t drb_state{};

0 commit comments

Comments
 (0)