mirror of https://github.com/pvnis/srsRAN_4G.git
enb,rrc: add skeleton code for new RRC internal interface for SgNB addition
parent
fd7b9a0575
commit
8d443d79e5
@ -0,0 +1,112 @@
|
||||
/**
|
||||
*
|
||||
* \section COPYRIGHT
|
||||
*
|
||||
* Copyright 2013-2021 Software Radio Systems Limited
|
||||
*
|
||||
* By using this file, you agree to the terms and conditions set
|
||||
* forth in the LICENSE file which can be found at the top level of
|
||||
* the distribution.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef SRSENB_RRC_ENDC_H
|
||||
#define SRSENB_RRC_ENDC_H
|
||||
|
||||
#include "rrc.h"
|
||||
#include "rrc_ue.h"
|
||||
#include "srsran/adt/fsm.h"
|
||||
#include <map>
|
||||
|
||||
namespace srsenb {
|
||||
|
||||
/**
|
||||
* @brief This procedure handles the secondary node (SgNB) addition for
|
||||
* EUTRA-NR Dual connectivity (ENDC)
|
||||
*
|
||||
*/
|
||||
|
||||
class rrc::ue::rrc_endc : public srsran::fsm_t<rrc::ue::rrc_endc>
|
||||
{
|
||||
public:
|
||||
// public events
|
||||
struct user_crnti_upd_ev {
|
||||
uint16_t crnti;
|
||||
uint16_t temp_crnti;
|
||||
};
|
||||
struct ho_cancel_ev {
|
||||
asn1::s1ap::cause_c cause;
|
||||
|
||||
ho_cancel_ev(const asn1::s1ap::cause_c& cause_) : cause(cause_) {}
|
||||
};
|
||||
|
||||
rrc_endc(srsenb::rrc::ue* outer_ue);
|
||||
|
||||
bool fill_conn_recfg(asn1::rrc::rrc_conn_recfg_r8_ies_s* conn_recfg);
|
||||
void handle_ue_meas_report(const asn1::rrc::meas_report_s& msg, srsran::unique_byte_buffer_t pdu);
|
||||
|
||||
void handle_sgnb_addition_ack(const asn1::dyn_octstring& nr_secondary_cell_group_cfg_r15,
|
||||
const asn1::dyn_octstring& nr_radio_bearer_cfg1_r15);
|
||||
void handle_sgnb_addition_reject();
|
||||
|
||||
private:
|
||||
// Send SgNB addition request to gNB
|
||||
bool start_sgnb_addition();
|
||||
|
||||
bool is_endc_activation_running() const { return not is_in_state<idle_st>(); }
|
||||
|
||||
rrc::ue* rrc_ue = nullptr;
|
||||
rrc* rrc_enb = nullptr;
|
||||
srslog::basic_logger& logger;
|
||||
|
||||
// vars
|
||||
asn1::rrc::rrc_conn_recfg_complete_s pending_recfg_complete;
|
||||
|
||||
// events
|
||||
struct sgnb_add_req_sent_ev {};
|
||||
struct sgnb_add_req_ack_ev {};
|
||||
struct sgnb_add_req_reject_ev {};
|
||||
struct prach_nr_received_ev {};
|
||||
|
||||
using recfg_complete_ev = asn1::rrc::rrc_conn_recfg_complete_s;
|
||||
using status_transfer_ev = asn1::s1ap::bearers_subject_to_status_transfer_list_l;
|
||||
|
||||
// states
|
||||
struct idle_st {};
|
||||
struct wait_sgnb_add_req_resp {};
|
||||
struct wait_recfg_comp {};
|
||||
struct wait_prach_nr {};
|
||||
|
||||
// FSM guards
|
||||
|
||||
// FSM transition handlers
|
||||
void handle_recfg_complete(wait_recfg_comp& s, const recfg_complete_ev& ev);
|
||||
void handle_sgnb_addition_request_sent(const sgnb_add_req_sent_ev& ev);
|
||||
|
||||
protected:
|
||||
// states
|
||||
state_list<idle_st, wait_sgnb_add_req_resp, wait_recfg_comp, wait_prach_nr> states{this,
|
||||
idle_st{},
|
||||
wait_sgnb_add_req_resp{},
|
||||
wait_recfg_comp{},
|
||||
wait_prach_nr{}};
|
||||
|
||||
// transitions
|
||||
using fsm = rrc_endc;
|
||||
// clang-format off
|
||||
using transitions = transition_table<
|
||||
// Start Target Event Action Guard
|
||||
// +-----------------------+-----------------------+------------------------+----------------------------+-------------------------+
|
||||
row< idle_st, wait_sgnb_add_req_resp, sgnb_add_req_sent_ev, nullptr >,
|
||||
// +-----------------------+-----------------------+------------------------+----------------------------+-------------------------+
|
||||
row< wait_sgnb_add_req_resp, wait_recfg_comp, sgnb_add_req_ack_ev >,
|
||||
row< wait_sgnb_add_req_resp, idle_st, sgnb_add_req_reject_ev >,
|
||||
row< wait_recfg_comp, idle_st, recfg_complete_ev, &fsm::handle_recfg_complete >
|
||||
// +----------------+-------------------+---------------------+----------------------------+-------------------------+
|
||||
>;
|
||||
// clang-format on
|
||||
};
|
||||
|
||||
} // namespace srsenb
|
||||
|
||||
#endif // SRSENB_RRC_ENDC_H
|
@ -0,0 +1,95 @@
|
||||
/**
|
||||
*
|
||||
* \section COPYRIGHT
|
||||
*
|
||||
* Copyright 2013-2021 Software Radio Systems Limited
|
||||
*
|
||||
* By using this file, you agree to the terms and conditions set
|
||||
* forth in the LICENSE file which can be found at the top level of
|
||||
* the distribution.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "srsenb/hdr/stack/rrc/rrc_endc.h"
|
||||
|
||||
namespace srsenb {
|
||||
|
||||
#define Info(fmt, ...) logger.info("ENDC: " fmt, ##__VA_ARGS__)
|
||||
#define Error(fmt, ...) logger.error("ENDC: " fmt, ##__VA_ARGS__)
|
||||
#define Warning(fmt, ...) logger.warning("ENDC: " fmt, ##__VA_ARGS__)
|
||||
#define Debug(fmt, ...) logger.debug("ENDC: " fmt, ##__VA_ARGS__)
|
||||
|
||||
#define procInfo(fmt, ...) parent->logger.info("Proc \"%s\" - " fmt, name(), ##__VA_ARGS__)
|
||||
#define procWarning(fmt, ...) parent->logger.warning("Proc \"%s\" - " fmt, name(), ##__VA_ARGS__)
|
||||
#define procError(fmt, ...) parent->logger.error("Proc \"%s\" - " fmt, name(), ##__VA_ARGS__)
|
||||
|
||||
using namespace asn1::rrc;
|
||||
|
||||
/*************************************************************************************************
|
||||
* rrc_endc class
|
||||
************************************************************************************************/
|
||||
|
||||
rrc::ue::rrc_endc::rrc_endc(rrc::ue* outer_ue) :
|
||||
base_t(outer_ue->parent->logger), rrc_ue(outer_ue), rrc_enb(outer_ue->parent), logger(outer_ue->parent->logger)
|
||||
{}
|
||||
|
||||
//! Method to add NR fields to a RRC Connection Reconfiguration Message
|
||||
bool rrc::ue::rrc_endc::fill_conn_recfg(asn1::rrc::rrc_conn_recfg_r8_ies_s* conn_recfg)
|
||||
{
|
||||
if (not is_endc_activation_running()) {
|
||||
// TODO: add measConfig related field to enable measurements on NR carrier
|
||||
return false;
|
||||
} else {
|
||||
// only add reconfigure EN-DC extension/release 15.10 field if ENDC activation is active
|
||||
conn_recfg->non_crit_ext_present = true;
|
||||
conn_recfg->non_crit_ext.non_crit_ext_present = true;
|
||||
conn_recfg->non_crit_ext.non_crit_ext.non_crit_ext_present = true;
|
||||
conn_recfg->non_crit_ext.non_crit_ext.non_crit_ext.non_crit_ext_present = true;
|
||||
conn_recfg->non_crit_ext.non_crit_ext.non_crit_ext.non_crit_ext.non_crit_ext_present = true;
|
||||
conn_recfg->non_crit_ext.non_crit_ext.non_crit_ext.non_crit_ext.non_crit_ext.non_crit_ext_present = true;
|
||||
conn_recfg->non_crit_ext.non_crit_ext.non_crit_ext.non_crit_ext.non_crit_ext.non_crit_ext.non_crit_ext_present =
|
||||
true;
|
||||
conn_recfg->non_crit_ext.non_crit_ext.non_crit_ext.non_crit_ext.non_crit_ext.non_crit_ext.non_crit_ext
|
||||
.non_crit_ext_present = true;
|
||||
rrc_conn_recfg_v1510_ies_s& reconf_v1510 = conn_recfg->non_crit_ext.non_crit_ext.non_crit_ext.non_crit_ext
|
||||
.non_crit_ext.non_crit_ext.non_crit_ext.non_crit_ext;
|
||||
reconf_v1510.nr_cfg_r15_present = true;
|
||||
reconf_v1510.sk_counter_r15_present = true;
|
||||
reconf_v1510.sk_counter_r15 = 0;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
//! Method called whenever the eNB receives a MeasReport from the UE
|
||||
void rrc::ue::rrc_endc::handle_ue_meas_report(const meas_report_s& msg, srsran::unique_byte_buffer_t pdu)
|
||||
{
|
||||
// Start EN-DC activation
|
||||
logger.info("Triggering SgNB addition");
|
||||
rrc_enb->rrc_nr->sgnb_addition_request(rrc_ue->rnti);
|
||||
}
|
||||
|
||||
void rrc::ue::rrc_endc::handle_sgnb_addition_ack(const asn1::dyn_octstring& nr_secondary_cell_group_cfg_r15,
|
||||
const asn1::dyn_octstring& nr_radio_bearer_cfg1_r15)
|
||||
{
|
||||
logger.info("Received SgNB addition acknowledgement for rnti=%d", rrc_ue->rnti);
|
||||
|
||||
// prepare reconfiguration message with NR fields
|
||||
srsran::unique_byte_buffer_t pdu = srsran::make_byte_buffer();
|
||||
if (pdu == nullptr) {
|
||||
logger.error("Couldn't allocate PDU in %s().", __FUNCTION__);
|
||||
return;
|
||||
}
|
||||
// rrc_enb->send_connection_reconf(std::move(pdu));
|
||||
}
|
||||
|
||||
void rrc::ue::rrc_endc::handle_sgnb_addition_reject()
|
||||
{
|
||||
logger.error("Received SgNB addition reject for rnti=%d", rrc_ue->rnti);
|
||||
}
|
||||
|
||||
void rrc::ue::rrc_endc::handle_recfg_complete(wait_recfg_comp& s, const recfg_complete_ev& ev)
|
||||
{
|
||||
logger.info("User rnti=0x%x successfully enabled EN-DC", rrc_ue->rnti);
|
||||
}
|
||||
|
||||
} // namespace srsenb
|
Loading…
Reference in New Issue