stack lte,refactor: pass bearer manager instead of stack pointer to srsenb::rrc

master
Francisco Paisana 3 years ago
parent f4df55c245
commit ebd12b0778

@ -83,9 +83,10 @@ void ue_bearer_manager::add_eps_bearer(uint8_t eps_bearer_id, srsran::srsran_rat
{
srsran::rwlock_write_guard rw_lock(rwlock);
if (impl.add_eps_bearer(eps_bearer_id, rat, lcid)) {
logger.info("Registered EPS bearer ID %d for lcid=%d over %s-PDCP", eps_bearer_id, lcid, to_string(rat).c_str());
logger.info(
"Bearers: Registered EPS bearer ID %d for lcid=%d over %s-PDCP", eps_bearer_id, lcid, to_string(rat).c_str());
} else {
logger.error("EPS bearer ID %d already registered", eps_bearer_id);
logger.error("Bearers: EPS bearer ID %d already registered", eps_bearer_id);
}
}
@ -93,16 +94,16 @@ void ue_bearer_manager::remove_eps_bearer(uint8_t eps_bearer_id)
{
srsran::rwlock_write_guard rw_lock(rwlock);
if (impl.remove_eps_bearer(eps_bearer_id)) {
logger.info("Removed mapping for EPS bearer ID %d", eps_bearer_id);
logger.info("Bearers: Removed mapping for EPS bearer ID %d", eps_bearer_id);
} else {
logger.error("Can't remove EPS bearer ID %d", eps_bearer_id);
logger.error("Bearers: Can't remove EPS bearer ID %d", eps_bearer_id);
}
}
void ue_bearer_manager::reset()
{
impl.reset();
logger.info("Reset EPS bearer manager");
logger.info("Bearers: Reset EPS bearer manager");
}
} // namespace srsue
@ -121,13 +122,13 @@ void enb_bearer_manager::add_eps_bearer(uint16_t rnti, uint8_t eps_bearer_id, sr
}
if (user_it->second.add_eps_bearer(eps_bearer_id, rat, lcid)) {
logger.info("Registered EPS bearer ID %d for rnti=0x%x, lcid=%d over %s-PDCP",
logger.info("Bearers: Registered eps-BearerID=%d for rnti=0x%x, lcid=%d over %s-PDCP",
eps_bearer_id,
rnti,
lcid,
to_string(rat).c_str());
} else {
logger.error("EPS bearer ID %d for rnti=0x%x already registered", eps_bearer_id, rnti);
logger.error("Bearers: EPS bearer ID %d for rnti=0x%x already registered", eps_bearer_id, rnti);
}
}
@ -135,24 +136,20 @@ void enb_bearer_manager::remove_eps_bearer(uint16_t rnti, uint8_t eps_bearer_id)
{
auto user_it = users_map.find(rnti);
if (user_it == users_map.end()) {
logger.error("No EPS bearer registered for rnti=0x%x", rnti);
logger.error("Bearers: No EPS bearer registered for rnti=0x%x", rnti);
return;
}
if (user_it->second.remove_eps_bearer(eps_bearer_id)) {
logger.info("Removed mapping for EPS bearer ID %d for rnti=0x%x", eps_bearer_id, rnti);
logger.info("Bearers: Removed mapping for EPS bearer ID %d for rnti=0x%x", eps_bearer_id, rnti);
} else {
logger.error("Can't remove EPS bearer ID %d, rnti=0x%x", eps_bearer_id, rnti);
logger.error("Bearers: Can't remove EPS bearer ID %d, rnti=0x%x", eps_bearer_id, rnti);
}
}
void enb_bearer_manager::rem_user(uint16_t rnti)
{
if (users_map.erase(rnti)) {
logger.info("Removed rnti=0x%x from EPS bearer manager", rnti);
} else {
logger.error("No EPS bearer registered for rnti=0x%x", rnti);
}
logger.info("Bearers: Removed rnti=0x%x from EPS bearer manager", rnti);
}
bool enb_bearer_manager::has_active_radio_bearer(uint16_t rnti, uint32_t eps_bearer_id)

@ -41,7 +41,6 @@ class gtpu_pdcp_adapter;
class enb_stack_lte final : public enb_stack_base,
public stack_interface_phy_lte,
public stack_interface_phy_nr,
public stack_interface_rrc,
public srsran::thread
{
public:
@ -136,11 +135,6 @@ public:
}
void rach_detected(const rach_info_t& rach_info) override { mac_nr.rach_detected(rach_info); }
// interface for bearer manager
void add_eps_bearer(uint16_t rnti, uint8_t eps_bearer_id, srsran::srsran_rat_t rat, uint32_t lcid) override;
void remove_eps_bearer(uint16_t rnti, uint8_t eps_bearer_id) override;
void remove_eps_bearers(uint16_t rnti) override;
private:
static const int STACK_MAIN_THREAD_PRIO = 4;
// thread loop

@ -19,6 +19,7 @@
#include "srsenb/hdr/common/common_enb.h"
#include "srsenb/hdr/common/rnti_pool.h"
#include "srsran/adt/circular_buffer.h"
#include "srsran/common/bearer_manager.h"
#include "srsran/common/buffer_pool.h"
#include "srsran/common/common.h"
#include "srsran/common/stack_procedure.h"
@ -53,7 +54,7 @@ class rrc final : public rrc_interface_pdcp,
public rrc_eutra_interface_rrc_nr
{
public:
explicit rrc(stack_interface_rrc* stack_, srsran::task_sched_handle task_sched_);
explicit rrc(srsran::task_sched_handle task_sched_, enb_bearer_manager& manager_);
~rrc();
int32_t init(const rrc_cfg_t& cfg_,
@ -166,7 +167,7 @@ public:
private:
// args
srsran::task_sched_handle task_sched;
stack_interface_rrc* stack = nullptr;
enb_bearer_manager& bearer_manager;
phy_interface_rrc_lte* phy = nullptr;
mac_interface_rrc* mac = nullptr;
rlc_interface_rrc* rlc = nullptr;

@ -98,7 +98,7 @@ enb_stack_lte::enb_stack_lte(srslog::sink& log_sink) :
rlc_nr(rlc_nr_logger),
gtpu(&task_sched, gtpu_logger, &rx_sockets),
s1ap(&task_sched, s1ap_logger, &rx_sockets),
rrc(this, &task_sched),
rrc(&task_sched, bearers),
rrc_nr(&task_sched),
mac_pcap(),
pending_stack_metrics(64)
@ -335,19 +335,4 @@ void enb_stack_lte::run_thread()
}
}
void enb_stack_lte::add_eps_bearer(uint16_t rnti, uint8_t eps_bearer_id, srsran::srsran_rat_t rat, uint32_t lcid)
{
bearers.add_eps_bearer(rnti, eps_bearer_id, rat, lcid);
}
void enb_stack_lte::remove_eps_bearer(uint16_t rnti, uint8_t eps_bearer_id)
{
bearers.remove_eps_bearer(rnti, eps_bearer_id);
}
void enb_stack_lte::remove_eps_bearers(uint16_t rnti)
{
bearers.rem_user(rnti);
}
} // namespace srsenb

@ -32,8 +32,8 @@ using namespace asn1::rrc;
namespace srsenb {
rrc::rrc(stack_interface_rrc* stack_, srsran::task_sched_handle task_sched_) :
logger(srslog::fetch_basic_logger("RRC")), stack(stack_), task_sched(task_sched_), rx_pdu_queue(128)
rrc::rrc(srsran::task_sched_handle task_sched_, enb_bearer_manager& manager_) :
logger(srslog::fetch_basic_logger("RRC")), bearer_manager(manager_), task_sched(task_sched_), rx_pdu_queue(128)
{}
rrc::~rrc() {}
@ -655,7 +655,7 @@ void rrc::rem_user(uint16_t rnti)
gtpu->rem_user(rnti);
// Now remove RLC and PDCP
stack->remove_eps_bearers(rnti);
bearer_manager.rem_user(rnti);
rlc->rem_user(rnti);
pdcp->rem_user(rnti);

@ -1443,8 +1443,8 @@ void rrc::ue::apply_rlc_rb_updates(const rr_cfg_ded_s& pending_rr_cfg)
parent->rlc->del_bearer(rnti, drb_to_lcid((lte_drb)drb_id));
// deregister EPS bearer
uint8_t eps_bearer_id = 0; // FIXME: lookup EPS bearer ID for drb_id
parent->stack->remove_eps_bearer(rnti, eps_bearer_id);
uint8_t eps_bearer_id = parent->bearer_manager.get_lcid_bearer(rnti, drb_to_lcid((lte_drb)drb_id)).eps_bearer_id;
parent->bearer_manager.remove_eps_bearer(rnti, eps_bearer_id);
}
}
for (const drb_to_add_mod_s& drb : pending_rr_cfg.drb_to_add_mod_list) {
@ -1460,7 +1460,7 @@ void rrc::ue::apply_rlc_rb_updates(const rr_cfg_ded_s& pending_rr_cfg)
parent->rlc->add_bearer(rnti, drb.lc_ch_id, rlc_cfg);
// register EPS bearer over LTE PDCP
parent->stack->add_eps_bearer(rnti, drb.eps_bearer_id, srsran::srsran_rat_t::lte, drb.lc_ch_id);
parent->bearer_manager.add_eps_bearer(rnti, drb.eps_bearer_id, srsran::srsran_rat_t::lte, drb.lc_ch_id);
}
}

@ -33,8 +33,8 @@ int test_erab_setup(srsran::log_sink_spy& spy, bool qci_exists)
logger.set_hex_dump_max_size(1024);
logger.set_level(srslog::basic_levels::info);
test_dummies::enb_stack_dummy stack;
srsenb::rrc rrc{&stack, &task_sched};
enb_bearer_manager bearers;
srsenb::rrc rrc{&task_sched, bearers};
mac_dummy mac;
rlc_dummy rlc;
test_dummies::pdcp_mobility_dummy pdcp;

@ -57,7 +57,7 @@ const char* to_string(test_event event)
struct mobility_tester {
explicit mobility_tester(const test_event& args_) :
args(args_), logger(srslog::fetch_basic_logger("RRC")), rrc(&stack, &task_sched)
args(args_), logger(srslog::fetch_basic_logger("RRC")), rrc(&task_sched, bearers)
{
logger.set_level(srslog::basic_levels::info);
logger.set_hex_dump_max_size(1024);
@ -93,7 +93,7 @@ struct mobility_tester {
test_dummies::pdcp_mobility_dummy pdcp;
test_dummies::phy_mobility_dummy phy;
test_dummies::s1ap_mobility_dummy s1ap;
test_dummies::enb_stack_dummy stack;
enb_bearer_manager bearers;
gtpu_dummy gtpu;
void tic()

@ -201,13 +201,6 @@ public:
phy_rrc_cfg_list_t last_cfg;
};
class enb_stack_dummy : public stack_interface_rrc
{
void add_eps_bearer(uint16_t rnti, uint8_t eps_bearer_id, srsran::srsran_rat_t rat, uint32_t lcid) {}
void remove_eps_bearer(uint16_t rnti, uint8_t eps_bearer_id) {}
void remove_eps_bearers(uint16_t rnti){};
};
} // namespace test_dummies
namespace test_helpers {

Loading…
Cancel
Save