nr,gnb,rrc: use multiqueue to forward x2 tasks to NR stack

master
Francisco 3 years ago committed by Andre Puschmann
parent d32bfa3756
commit 0b51848dda

@ -36,13 +36,13 @@ public:
}; };
/// Request addition of NR carrier for UE /// Request addition of NR carrier for UE
virtual int sgnb_addition_request(uint16_t eutra_rnti, const sgnb_addition_req_params_t& params) = 0; virtual void sgnb_addition_request(uint16_t eutra_rnti, const sgnb_addition_req_params_t& params) = 0;
/// Provide information whether the requested configuration was applied successfully by the UE /// Provide information whether the requested configuration was applied successfully by the UE
virtual int sgnb_reconfiguration_complete(uint16_t eutra_rnti, asn1::dyn_octstring reconfig_response) = 0; virtual void sgnb_reconfiguration_complete(uint16_t eutra_rnti, const asn1::dyn_octstring& reconfig_response) = 0;
/// Trigger release for specific UE /// Trigger release for specific UE
virtual int sgnb_release_request(uint16_t nr_rnti) = 0; virtual void sgnb_release_request(uint16_t nr_rnti) = 0;
}; };
/// X2AP inspired interface for response from NR RRC to EUTRA RRC /// X2AP inspired interface for response from NR RRC to EUTRA RRC

@ -126,7 +126,10 @@ public:
// Note: RRC processes activity asynchronously, so there is no need to use x2_task_queue // Note: RRC processes activity asynchronously, so there is no need to use x2_task_queue
rrc.set_activity_user(eutra_rnti); rrc.set_activity_user(eutra_rnti);
} }
void sgnb_release_ack(uint16_t eutra_rnti) final { rrc.sgnb_release_ack(eutra_rnti); } void sgnb_release_ack(uint16_t eutra_rnti) final
{
x2_task_queue.push([this, eutra_rnti]() { rrc.sgnb_release_ack(eutra_rnti); });
}
// gtpu_interface_pdcp // gtpu_interface_pdcp
void write_pdu(uint16_t rnti, uint32_t lcid, srsran::unique_byte_buffer_t pdu); void write_pdu(uint16_t rnti, uint32_t lcid, srsran::unique_byte_buffer_t pdu);

@ -81,15 +81,19 @@ public:
// X2 interface // X2 interface
// control plane, i.e. rrc_nr_interface_rrc // control plane, i.e. rrc_nr_interface_rrc
int sgnb_addition_request(uint16_t eutra_rnti, const sgnb_addition_req_params_t& params) final void sgnb_addition_request(uint16_t eutra_rnti, const sgnb_addition_req_params_t& params) final
{ {
return rrc.sgnb_addition_request(eutra_rnti, params); x2_task_queue.push([this, eutra_rnti, params]() { rrc.sgnb_addition_request(eutra_rnti, params); });
}; };
int sgnb_reconfiguration_complete(uint16_t eutra_rnti, asn1::dyn_octstring reconfig_response) final void sgnb_reconfiguration_complete(uint16_t eutra_rnti, const asn1::dyn_octstring& reconfig_response) final
{ {
return rrc.sgnb_reconfiguration_complete(eutra_rnti, reconfig_response); x2_task_queue.push(
[this, eutra_rnti, reconfig_response]() { rrc.sgnb_reconfiguration_complete(eutra_rnti, reconfig_response); });
}; };
int sgnb_release_request(uint16_t nr_rnti) final { return rrc.sgnb_release_request(nr_rnti); }; void sgnb_release_request(uint16_t nr_rnti) final
{
x2_task_queue.push([this, nr_rnti]() { return rrc.sgnb_release_request(nr_rnti); });
}
// X2 data interface // X2 data interface
void write_sdu(uint16_t rnti, uint32_t lcid, srsran::unique_byte_buffer_t sdu, int pdcp_sn = -1) final void write_sdu(uint16_t rnti, uint32_t lcid, srsran::unique_byte_buffer_t sdu, int pdcp_sn = -1) final
{ {
@ -122,8 +126,8 @@ private:
// task scheduling // task scheduling
static const int STACK_MAIN_THREAD_PRIO = 4; static const int STACK_MAIN_THREAD_PRIO = 4;
srsran::task_scheduler task_sched; srsran::task_scheduler task_sched;
srsran::task_multiqueue::queue_handle sync_task_queue, ue_task_queue, gtpu_task_queue, mac_task_queue, srsran::task_multiqueue::queue_handle sync_task_queue, gtpu_task_queue, metrics_task_queue, gnb_task_queue,
metrics_task_queue, gnb_task_queue; x2_task_queue;
// metrics waiting condition // metrics waiting condition
std::mutex metrics_mutex; std::mutex metrics_mutex;

@ -86,9 +86,9 @@ public:
void notify_pdcp_integrity_error(uint16_t rnti, uint32_t lcid) final; void notify_pdcp_integrity_error(uint16_t rnti, uint32_t lcid) final;
// Interface for EUTRA RRC // Interface for EUTRA RRC
int sgnb_addition_request(uint16_t rnti, const sgnb_addition_req_params_t& params); void sgnb_addition_request(uint16_t rnti, const sgnb_addition_req_params_t& params);
int sgnb_reconfiguration_complete(uint16_t rnti, asn1::dyn_octstring reconfig_response); void sgnb_reconfiguration_complete(uint16_t rnti, const asn1::dyn_octstring& reconfig_response) final;
int sgnb_release_request(uint16_t nr_rnti); void sgnb_release_request(uint16_t nr_rnti) final;
// Interfaces for NGAP // Interfaces for NGAP
int ue_set_security_cfg_key(uint16_t rnti, const asn1::fixed_bitstring<256, false, true>& key); int ue_set_security_cfg_key(uint16_t rnti, const asn1::fixed_bitstring<256, false, true>& key);

@ -39,22 +39,26 @@ namespace srsenb {
class x2_adapter final : public x2_interface class x2_adapter final : public x2_interface
{ {
public: public:
x2_adapter(enb_stack_lte* eutra_stack_, gnb_stack_nr* nr_stack_) : nr_stack(nr_stack_), eutra_stack(eutra_stack_) {} x2_adapter(enb_stack_lte* eutra_stack_, gnb_stack_nr* nr_stack_) :
nr_stack(nr_stack_), eutra_stack(eutra_stack_), logger(srslog::fetch_basic_logger("X2"))
{}
/// rrc_nr_interface_rrc /// rrc_nr_interface_rrc
int sgnb_addition_request(uint16_t eutra_rnti, const sgnb_addition_req_params_t& params) override void sgnb_addition_request(uint16_t eutra_rnti, const sgnb_addition_req_params_t& params) override
{ {
if (nr_stack == nullptr) { if (nr_stack == nullptr) {
return SRSRAN_ERROR; logger.error("SgNB Addition Requested for inexistent NR stack");
return;
} }
return nr_stack->sgnb_addition_request(eutra_rnti, params); nr_stack->sgnb_addition_request(eutra_rnti, params);
} }
int sgnb_reconfiguration_complete(uint16_t eutra_rnti, asn1::dyn_octstring reconfig_response) override void sgnb_reconfiguration_complete(uint16_t eutra_rnti, const asn1::dyn_octstring& reconfig_response) override
{ {
if (nr_stack == nullptr) { if (nr_stack == nullptr) {
return SRSRAN_ERROR; logger.error("SgNB Addition Requested for inexistent NR stack");
return;
} }
return nr_stack->sgnb_reconfiguration_complete(eutra_rnti, reconfig_response); nr_stack->sgnb_reconfiguration_complete(eutra_rnti, reconfig_response);
} }
/// rrc_eutra_interface_rrc_nr /// rrc_eutra_interface_rrc_nr
@ -96,12 +100,13 @@ public:
eutra_stack->set_activity_user(eutra_rnti); eutra_stack->set_activity_user(eutra_rnti);
} }
int sgnb_release_request(uint16_t nr_rnti) override void sgnb_release_request(uint16_t nr_rnti) override
{ {
if (nr_stack == nullptr) { if (nr_stack == nullptr) {
return SRSRAN_ERROR; logger.error("SgNB Addition Requested for inexistent NR stack");
return;
} }
return nr_stack->sgnb_release_request(nr_rnti); nr_stack->sgnb_release_request(nr_rnti);
} }
// pdcp_interface_gtpu // pdcp_interface_gtpu
@ -132,6 +137,7 @@ public:
private: private:
enb_stack_lte* eutra_stack = nullptr; enb_stack_lte* eutra_stack = nullptr;
gnb_stack_nr* nr_stack = nullptr; gnb_stack_nr* nr_stack = nullptr;
srslog::basic_logger& logger;
}; };
} // namespace srsenb } // namespace srsenb

@ -30,12 +30,11 @@ gnb_stack_nr::gnb_stack_nr(srslog::sink& log_sink) :
pdcp(&task_sched, pdcp_logger), pdcp(&task_sched, pdcp_logger),
rlc(rlc_logger) rlc(rlc_logger)
{ {
ue_task_queue = task_sched.make_task_queue();
sync_task_queue = task_sched.make_task_queue(); sync_task_queue = task_sched.make_task_queue();
gtpu_task_queue = task_sched.make_task_queue(); gtpu_task_queue = task_sched.make_task_queue();
mac_task_queue = task_sched.make_task_queue();
metrics_task_queue = task_sched.make_task_queue(); metrics_task_queue = task_sched.make_task_queue();
gnb_task_queue = task_sched.make_task_queue(); gnb_task_queue = task_sched.make_task_queue();
x2_task_queue = task_sched.make_task_queue();
} }
gnb_stack_nr::~gnb_stack_nr() gnb_stack_nr::~gnb_stack_nr()

@ -605,7 +605,7 @@ void rrc::sgnb_addition_complete(uint16_t eutra_rnti, uint16_t nr_rnti)
void rrc::sgnb_release_ack(uint16_t eutra_rnti) void rrc::sgnb_release_ack(uint16_t eutra_rnti)
{ {
logger.info("Received SgNB release acknowledgement for rnti=%d", eutra_rnti); logger.info("Received SgNB release acknowledgement for rnti=0x%x", eutra_rnti);
auto ue_it = users.find(eutra_rnti); auto ue_it = users.find(eutra_rnti);
if (ue_it == users.end()) { if (ue_it == users.end()) {
logger.warning("rnti=0x%x does not exist", eutra_rnti); logger.warning("rnti=0x%x does not exist", eutra_rnti);

@ -485,9 +485,8 @@ void rrc_nr::write_dl_info(uint16_t rnti, srsran::unique_byte_buffer_t sdu) {}
Interface for EUTRA RRC Interface for EUTRA RRC
*******************************************************************************/ *******************************************************************************/
int rrc_nr::sgnb_addition_request(uint16_t eutra_rnti, const sgnb_addition_req_params_t& params) void rrc_nr::sgnb_addition_request(uint16_t eutra_rnti, const sgnb_addition_req_params_t& params)
{ {
task_sched.defer_task([this, eutra_rnti, params]() {
// try to allocate new user // try to allocate new user
sched_nr_ue_cfg_t uecfg{}; sched_nr_ue_cfg_t uecfg{};
uecfg.carriers.resize(1); uecfg.carriers.resize(1);
@ -521,22 +520,16 @@ int rrc_nr::sgnb_addition_request(uint16_t eutra_rnti, const sgnb_addition_req_p
return; return;
} }
user_it->second->handle_sgnb_addition_request(eutra_rnti, params); user_it->second->handle_sgnb_addition_request(eutra_rnti, params);
});
// return straight away
return SRSRAN_SUCCESS;
} }
int rrc_nr::sgnb_reconfiguration_complete(uint16_t eutra_rnti, asn1::dyn_octstring reconfig_response) void rrc_nr::sgnb_reconfiguration_complete(uint16_t eutra_rnti, const asn1::dyn_octstring& reconfig_response)
{ {
// user has completeted the reconfiguration and has acked on 4G side, wait until RA on NR // user has completeted the reconfiguration and has acked on 4G side, wait until RA on NR
logger.info("Received Reconfiguration complete for RNTI=0x%x", eutra_rnti); logger.info("Received Reconfiguration complete for RNTI=0x%x", eutra_rnti);
return SRSRAN_SUCCESS;
} }
int rrc_nr::sgnb_release_request(uint16_t nr_rnti) void rrc_nr::sgnb_release_request(uint16_t nr_rnti)
{ {
task_sched.defer_task([this, nr_rnti]() {
// remove user // remove user
auto it = users.find(nr_rnti); auto it = users.find(nr_rnti);
uint16_t eutra_rnti = it != users.end() ? it->second->get_eutra_rnti() : SRSRAN_INVALID_RNTI; uint16_t eutra_rnti = it != users.end() ? it->second->get_eutra_rnti() : SRSRAN_INVALID_RNTI;
@ -544,8 +537,6 @@ int rrc_nr::sgnb_release_request(uint16_t nr_rnti)
if (eutra_rnti != SRSRAN_INVALID_RNTI) { if (eutra_rnti != SRSRAN_INVALID_RNTI) {
rrc_eutra->sgnb_release_ack(eutra_rnti); rrc_eutra->sgnb_release_ack(eutra_rnti);
} }
});
return SRSRAN_SUCCESS;
} }
/******************************************************************************* /*******************************************************************************

Loading…
Cancel
Save