|
|
@ -11,6 +11,7 @@
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#include "srsgnb/hdr/stack/ngap/ngap_ue_bearer_manager.h"
|
|
|
|
#include "srsgnb/hdr/stack/ngap/ngap_ue_bearer_manager.h"
|
|
|
|
|
|
|
|
#include "srsran/common/common_nr.h"
|
|
|
|
|
|
|
|
|
|
|
|
namespace srsenb {
|
|
|
|
namespace srsenb {
|
|
|
|
ngap_ue_bearer_manager::ngap_ue_bearer_manager(gtpu_interface_rrc* gtpu_, srslog::basic_logger& logger_) :
|
|
|
|
ngap_ue_bearer_manager::ngap_ue_bearer_manager(gtpu_interface_rrc* gtpu_, srslog::basic_logger& logger_) :
|
|
|
@ -39,6 +40,10 @@ int ngap_ue_bearer_manager::add_pdu_session(uint16_t
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
lcid = allocate_lcid(rnti);
|
|
|
|
lcid = allocate_lcid(rnti);
|
|
|
|
|
|
|
|
if (lcid >= srsran::MAX_NR_NOF_BEARERS) {
|
|
|
|
|
|
|
|
logger.error("Adding PDU Session ID=%d to GTPU. No free LCID.", pdu_session_id);
|
|
|
|
|
|
|
|
return SRSRAN_ERROR;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// TODO: remove lcid and just use pdu_session_id and rnti as id for GTP tunnel
|
|
|
|
// TODO: remove lcid and just use pdu_session_id and rnti as id for GTP tunnel
|
|
|
|
int rtn = add_gtpu_bearer(rnti, pdu_session_id, teid_out, addr_out, tunnel);
|
|
|
|
int rtn = add_gtpu_bearer(rnti, pdu_session_id, teid_out, addr_out, tunnel);
|
|
|
@ -65,7 +70,6 @@ int ngap_ue_bearer_manager::reset_pdu_sessions(uint16_t rnti)
|
|
|
|
auto pdu_session_id = iter->first;
|
|
|
|
auto pdu_session_id = iter->first;
|
|
|
|
rem_gtpu_bearer(rnti, pdu_session_id);
|
|
|
|
rem_gtpu_bearer(rnti, pdu_session_id);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
next_lcid_list.erase(rnti);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -116,10 +120,20 @@ void ngap_ue_bearer_manager::rem_gtpu_bearer(uint16_t rnti, uint32_t pdu_session
|
|
|
|
|
|
|
|
|
|
|
|
uint8_t ngap_ue_bearer_manager::allocate_lcid(uint32_t rnti)
|
|
|
|
uint8_t ngap_ue_bearer_manager::allocate_lcid(uint32_t rnti)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (next_lcid_list.find(rnti) == next_lcid_list.end()) {
|
|
|
|
if (pdu_session_list.empty()) {
|
|
|
|
next_lcid_list[rnti] = 4;
|
|
|
|
return 4;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
for (unsigned lcid = 4; lcid < srsran::MAX_NR_NOF_BEARERS; lcid++) {
|
|
|
|
|
|
|
|
const auto pdu_session_it =
|
|
|
|
|
|
|
|
std::find_if(pdu_session_list.cbegin(),
|
|
|
|
|
|
|
|
pdu_session_list.cend(),
|
|
|
|
|
|
|
|
[lcid](const std::pair<uint8_t, pdu_session_t>& t) { return t.second.lcid != lcid; });
|
|
|
|
|
|
|
|
if (pdu_session_it != pdu_session_list.cend()) {
|
|
|
|
|
|
|
|
return lcid;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return next_lcid_list[rnti]++;
|
|
|
|
// All LCIDs are used.
|
|
|
|
|
|
|
|
return srsran::MAX_NR_NOF_BEARERS;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
} // namespace srsenb
|
|
|
|
} // namespace srsenb
|
|
|
|