create typedef for circular map of rntis. check return of gtpu ue creation

This commit is contained in:
Francisco 2021-05-06 18:27:41 +01:00 committed by Francisco Paisana
parent 9464f36714
commit 1677abce8d
5 changed files with 16 additions and 8 deletions

View File

@ -17,6 +17,7 @@
INCLUDES
*******************************************************************************/
#include "srsran/adt/circular_map.h"
#include "srsran/common/common_lte.h"
#include <stdint.h>
@ -48,6 +49,10 @@ constexpr uint32_t drb_to_lcid(lte_drb drb_id)
#define SRSENB_MAX_BUFFER_SIZE_BYTES 12756
#define SRSENB_BUFFER_HEADER_OFFSET 1024
/// Typedef of circular map container which key corresponding to rnti value and that can be used across layers
template <typename UEObject>
using rnti_map_t = srsran::static_circular_map<uint16_t, UEObject, SRSENB_MAX_UES>;
} // namespace srsenb
#endif // SRSENB_COMMON_ENB_H

View File

@ -136,9 +136,9 @@ private:
sched_interface::dl_pdu_mch_t mch = {};
/* Map of active UEs */
srsran::static_circular_map<uint16_t, std::unique_ptr<ue>, 64> ue_db;
std::map<uint16_t, std::unique_ptr<ue> > ues_to_rem;
uint16_t last_rnti = 70;
rnti_map_t<std::unique_ptr<ue> > ue_db;
std::map<uint16_t, std::unique_ptr<ue> > ues_to_rem;
uint16_t last_rnti = 70;
srsran::static_blocking_queue<std::unique_ptr<ue>, 32> ue_pool; ///< Pool of pre-allocated UE objects
void prealloc_ue(uint32_t nof_ue);

View File

@ -64,7 +64,7 @@ private:
uint32_t ul_nof_samples = 0;
};
srsran::static_circular_map<uint16_t, ue_ctxt, SRSENB_MAX_UES> ue_history_db;
rnti_map_t<ue_ctxt> ue_history_db;
struct ue_dl_prio_compare {
bool operator()(const ue_ctxt* lhs, const ue_ctxt* rhs) const;

View File

@ -36,7 +36,6 @@ struct gtpu_header_t;
namespace srsenb {
class pdcp_interface_gtpu;
class stack_interface_gtpu_lte;
class gtpu_tunnel_manager
{
@ -120,8 +119,8 @@ private:
pdcp_interface_gtpu* pdcp = nullptr;
srslog::basic_logger& logger;
srsran::static_circular_map<uint16_t, ue_lcid_tunnel_list, SRSENB_MAX_UES> ue_teidin_db;
tunnel_list_t tunnels;
rnti_map_t<ue_lcid_tunnel_list> ue_teidin_db;
tunnel_list_t tunnels;
};
using gtpu_tunnel_state = gtpu_tunnel_manager::tunnel_state;

View File

@ -91,7 +91,11 @@ const gtpu_tunnel* gtpu_tunnel_manager::add_tunnel(uint16_t rnti, uint32_t lcid,
tun->spgw_addr = spgw_addr;
if (not ue_teidin_db.contains(rnti)) {
ue_teidin_db.insert(rnti, ue_lcid_tunnel_list());
auto ret = ue_teidin_db.insert(rnti, ue_lcid_tunnel_list());
if (ret.is_error()) {
logger.error("Failed to allocate rnti=0x%x", rnti);
return nullptr;
}
}
auto& ue_tunnels = ue_teidin_db[rnti];