breaking enb_interfaces.h into multiple files on a layer basis. Created enb_rrc_interfaces.h, enb_mac_interfaces.h and enb_s1ap_interfaces.h

master
Francisco 4 years ago committed by Francisco Paisana
parent dd6d6f731d
commit 43e57df00b

@ -16,11 +16,11 @@
#include "rlc_interface_types.h"
#include "rrc_interface_types.h"
#include "srslte/asn1/rrc_utils.h"
#include "srslte/asn1/s1ap_utils.h"
#include "srslte/common/common.h"
#include "srslte/common/interfaces_common.h"
#include "srslte/common/security.h"
#include "srslte/interfaces/sched_interface.h"
#include <map>
#include <vector>
#ifndef SRSLTE_ENB_INTERFACES_H
@ -28,172 +28,6 @@
namespace srsenb {
/* Interface PHY -> MAC */
class mac_interface_phy_lte
{
public:
const static int MAX_GRANTS = 64;
/**
* DL grant structure per UE
*/
struct dl_sched_grant_t {
srslte_dci_dl_t dci = {};
uint8_t* data[SRSLTE_MAX_TB] = {};
srslte_softbuffer_tx_t* softbuffer_tx[SRSLTE_MAX_TB] = {};
};
/**
* DL Scheduling result per cell/carrier
*/
typedef struct {
dl_sched_grant_t pdsch[MAX_GRANTS]; //< DL Grants
uint32_t nof_grants; //< Number of DL grants
uint32_t cfi; //< Current CFI of the cell, it can vary across cells
} dl_sched_t;
/**
* List of DL scheduling results, one entry per cell/carrier
*/
typedef std::vector<dl_sched_t> dl_sched_list_t;
typedef struct {
uint16_t rnti;
bool ack;
} ul_sched_ack_t;
/**
* UL grant information per UE
*/
typedef struct {
srslte_dci_ul_t dci;
uint32_t pid;
uint32_t current_tx_nb;
uint8_t* data;
bool needs_pdcch;
srslte_softbuffer_rx_t* softbuffer_rx;
} ul_sched_grant_t;
/**
* UL Scheduling result per cell/carrier
*/
typedef struct {
ul_sched_grant_t pusch[MAX_GRANTS];
ul_sched_ack_t phich[MAX_GRANTS];
uint32_t nof_grants;
uint32_t nof_phich;
} ul_sched_t;
/**
* List of UL scheduling results, one entry per cell/carrier
*/
typedef std::vector<ul_sched_t> ul_sched_list_t;
virtual int sr_detected(uint32_t tti, uint16_t rnti) = 0;
virtual void rach_detected(uint32_t tti, uint32_t primary_cc_idx, uint32_t preamble_idx, uint32_t time_adv) = 0;
/**
* PHY callback for giving MAC the Rank Indicator information of a given RNTI for an eNb cell/carrier.
*
* @param tti the given TTI
* @param rnti the UE identifier in the eNb
* @param cc_idx The eNb Cell/Carrier where the measurement corresponds
* @param ri_value the actual Rank Indicator value, 0 for 1 layer, 1 for two layers and so on.
* @return SRSLTE_SUCCESS if no error occurs, SRSLTE_ERROR* if an error occurs
*/
virtual int ri_info(uint32_t tti, uint16_t rnti, uint32_t cc_idx, uint32_t ri_value) = 0;
/**
* PHY callback for giving MAC the Pre-coding Matrix Indicator information of a given RNTI for an eNb cell/carrier.
*
* @param tti the given TTI
* @param rnti the UE identifier in the eNb
* @param cc_idx The eNb Cell/Carrier where the measurement corresponds
* @param pmi_value the actual PMI value
* @return SRSLTE_SUCCESS if no error occurs, SRSLTE_ERROR* if an error occurs
*/
virtual int pmi_info(uint32_t tti, uint16_t rnti, uint32_t cc_idx, uint32_t pmi_value) = 0;
/**
* PHY callback for for giving MAC the Channel Quality information of a given RNTI, TTI and eNb cell/carrier
* @param tti the given TTI
* @param rnti the UE identifier in the eNb
* @param cc_idx The eNb Cell/Carrier where the measurement corresponds
* @param cqi_value the corresponding Channel Quality Information
* @return SRSLTE_SUCCESS if no error occurs, SRSLTE_ERROR* if an error occurs
*/
virtual int cqi_info(uint32_t tti, uint16_t rnti, uint32_t cc_idx, uint32_t cqi_value) = 0;
typedef enum { PUSCH = 0, PUCCH, SRS } ul_channel_t;
/**
* PHY callback for giving MAC the SNR in dB of an UL transmission for a given RNTI at a given carrier
*
* @param tti The measurement was made
* @param rnti The UE identifier in the eNb
* @param cc_idx The eNb Cell/Carrier where the UL transmission was received
* @param snr_db The actual SNR of the received signal
* @param ch Indicates uplink channel (PUSCH, PUCCH or SRS)
* @return SRSLTE_SUCCESS if no error occurs, SRSLTE_ERROR* if an error occurs
*/
virtual int snr_info(uint32_t tti, uint16_t rnti, uint32_t cc_idx, float snr_db, ul_channel_t ch) = 0;
/**
* PHY callback for giving MAC the Time Aligment information in microseconds of a given RNTI during a TTI processing
*
* @param tti The measurement was made
* @param rnti The UE identifier in the eNb
* @param ta_us The actual time alignment in microseconds
* @return SRSLTE_SUCCESS if no error occurs, SRSLTE_ERROR* if an error occurs
*/
virtual int ta_info(uint32_t tti, uint16_t rnti, float ta_us) = 0;
/**
* PHY callback for giving MAC the HARQ DL ACK/NACK feedback information for a given RNTI, TTI, eNb cell/carrier and
* Transport block.
*
* @param tti the given TTI
* @param rnti the UE identifier in the eNb
* @param cc_idx the eNb Cell/Carrier identifier
* @param tb_idx the transport block index
* @param ack true for ACK, false for NACK, do not call for DTX
* @return SRSLTE_SUCCESS if no error occurs, SRSLTE_ERROR* if an error occurs
*/
virtual int ack_info(uint32_t tti, uint16_t rnti, uint32_t cc_idx, uint32_t tb_idx, bool ack) = 0;
/**
* Informs MAC about a received PUSCH transmission for given RNTI, TTI and eNb Cell/carrier.
*
* This function does not deallocate the uplink buffer. The function push_pdu() must be called after this
* to inform the MAC that the uplink buffer can be discarded or pushed to the stack
*
* @param tti the given TTI
* @param rnti the UE identifier in the eNb
* @param cc_idx the eNb Cell/Carrier identifier
* @param nof_bytes the number of grants carrierd by the PUSCH message
* @param crc_res the CRC check, set to true if the message was decoded succesfully
* @return SRSLTE_SUCCESS if no error occurs, SRSLTE_ERROR* if an error occurs
*/
virtual int crc_info(uint32_t tti, uint16_t rnti, uint32_t cc_idx, uint32_t nof_bytes, bool crc_res) = 0;
/**
* Pushes an uplink PDU through the stack if crc_res==true or discards it if crc_res==false
*
* @param tti the given TTI
* @param rnti the UE identifier in the eNb
* @param enb_cc_idx the eNb Cell/Carrier identifier
* @param nof_bytes the number of grants carrierd by the PUSCH message
* @param crc_res the CRC check, set to true if the message was decoded succesfully
* @return SRSLTE_SUCCESS if no error occurs, SRSLTE_ERROR* if an error occurs
*/
virtual int push_pdu(uint32_t tti_rx, uint16_t rnti, uint32_t enb_cc_idx, uint32_t nof_bytes, bool crc_res) = 0;
virtual int get_dl_sched(uint32_t tti, dl_sched_list_t& dl_sched_res) = 0;
virtual int get_mch_sched(uint32_t tti, bool is_mcch, dl_sched_list_t& dl_sched_res) = 0;
virtual int get_ul_sched(uint32_t tti, ul_sched_list_t& ul_sched_res) = 0;
virtual void set_sched_dl_tti_mask(uint8_t* tti_mask, uint32_t nof_sfs) = 0;
};
/* Interface MAC -> PHY */
class phy_interface_mac_lte
{
@ -269,50 +103,6 @@ public:
virtual void complete_config(uint16_t rnti) = 0;
};
class mac_interface_rrc
{
public:
/* Provides cell configuration including SIB periodicity, etc. */
virtual int cell_cfg(const std::vector<sched_interface::cell_cfg_t>& cell_cfg) = 0;
virtual void reset() = 0;
/* Manages UE configuration context */
virtual int ue_cfg(uint16_t rnti, sched_interface::ue_cfg_t* cfg) = 0;
virtual int ue_rem(uint16_t rnti) = 0;
/**
* Called after Msg3 reception to set the UE C-RNTI, resolve contention, and alter the UE's configuration in the
* scheduler and phy.
*
* @param temp_crnti temporary C-RNTI of the UE
* @param crnti chosen C-RNTI for the UE
* @param cfg new UE scheduler configuration
*/
virtual int ue_set_crnti(uint16_t temp_crnti, uint16_t crnti, sched_interface::ue_cfg_t* cfg) = 0;
/* Manages UE bearers and associated configuration */
virtual int bearer_ue_cfg(uint16_t rnti, uint32_t lc_id, sched_interface::ue_bearer_cfg_t* cfg) = 0;
virtual int bearer_ue_rem(uint16_t rnti, uint32_t lc_id) = 0;
virtual void phy_config_enabled(uint16_t rnti, bool enabled) = 0;
virtual void write_mcch(const srslte::sib2_mbms_t* sib2_,
const srslte::sib13_t* sib13_,
const srslte::mcch_msg_t* mcch_,
const uint8_t* mcch_payload,
const uint8_t mcch_payload_length) = 0;
/**
* Allocate a C-RNTI for a new user, without adding it to the phy layer and scheduler yet
* @return value of the allocated C-RNTI
*/
virtual uint16_t reserve_new_crnti(const sched_interface::ue_cfg_t& ue_cfg) = 0;
};
class mac_interface_rlc
{
public:
virtual int rlc_buffer_state(uint16_t rnti, uint32_t lc_id, uint32_t tx_queue, uint32_t retx_queue) = 0;
};
// RLC interface for MAC
class rlc_interface_mac
{
@ -392,74 +182,6 @@ public:
virtual void notify_delivery(uint16_t rnti, uint32_t lcid, const std::vector<uint32_t>& pdcp_sns) = 0;
};
// RRC interface for RLC
class rrc_interface_rlc
{
public:
virtual void read_pdu_pcch(uint8_t* payload, uint32_t payload_size) = 0;
virtual void max_retx_attempted(uint16_t rnti) = 0;
virtual void write_pdu(uint16_t rnti, uint32_t lcid, srslte::unique_byte_buffer_t sdu) = 0;
};
// RRC interface for MAC
class rrc_interface_mac
{
public:
/* Radio Link failure */
virtual int add_user(uint16_t rnti, const sched_interface::ue_cfg_t& init_ue_cfg) = 0;
virtual void upd_user(uint16_t new_rnti, uint16_t old_rnti) = 0;
virtual void set_activity_user(uint16_t rnti) = 0;
virtual bool is_paging_opportunity(uint32_t tti, uint32_t* payload_len) = 0;
///< Provide packed SIB to MAC (buffer is managed by RRC)
virtual uint8_t* read_pdu_bcch_dlsch(const uint8_t enb_cc_idx, const uint32_t sib_index) = 0;
};
// RRC interface for PDCP
class rrc_interface_pdcp
{
public:
virtual void write_pdu(uint16_t rnti, uint32_t lcid, srslte::unique_byte_buffer_t pdu) = 0;
};
// RRC interface for S1AP
class rrc_interface_s1ap
{
public:
virtual void write_dl_info(uint16_t rnti, srslte::unique_byte_buffer_t sdu) = 0;
virtual void release_complete(uint16_t rnti) = 0;
virtual bool setup_ue_ctxt(uint16_t rnti, const asn1::s1ap::init_context_setup_request_s& msg) = 0;
virtual bool modify_ue_ctxt(uint16_t rnti, const asn1::s1ap::ue_context_mod_request_s& msg) = 0;
virtual bool setup_ue_erabs(uint16_t rnti, const asn1::s1ap::erab_setup_request_s& msg) = 0;
virtual void modify_erabs(uint16_t rnti,
const asn1::s1ap::erab_modify_request_s& msg,
std::vector<uint16_t>* erabs_modified,
std::vector<uint16_t>* erabs_failed_to_modify) = 0;
virtual bool release_erabs(uint32_t rnti) = 0;
virtual void release_erabs(uint32_t rnti,
const asn1::s1ap::erab_release_cmd_s& msg,
std::vector<uint16_t>* erabs_released,
std::vector<uint16_t>* erabs_failed_to_release) = 0;
virtual void add_paging_id(uint32_t ueid, const asn1::s1ap::ue_paging_id_c& ue_paging_id) = 0;
/**
* Reports the reception of S1 HandoverCommand / HandoverPreparationFailure or abnormal conditions during
* S1 Handover preparation back to RRC.
*
* @param rnti user
* @param is_success true if ho cmd was received
* @param container TargeteNB RRCConnectionReconfiguration message with MobilityControlInfo
*/
virtual void ho_preparation_complete(uint16_t rnti,
bool is_success,
const asn1::s1ap::ho_cmd_s& msg,
srslte::unique_byte_buffer_t container) = 0;
virtual uint16_t
start_ho_ue_resource_alloc(const asn1::s1ap::ho_request_s& msg,
const asn1::s1ap::sourceenb_to_targetenb_transparent_container_s& container) = 0;
virtual void set_erab_status(uint16_t rnti, const asn1::s1ap::bearers_subject_to_status_transfer_list_l& erabs) = 0;
};
// GTPU interface for PDCP
class gtpu_interface_pdcp
{
@ -486,113 +208,11 @@ public:
virtual void rem_user(uint16_t rnti) = 0;
};
// S1AP interface for RRC
class s1ap_interface_rrc
{
public:
struct bearer_status_info {
uint8_t erab_id;
uint16_t pdcp_dl_sn, pdcp_ul_sn;
uint16_t dl_hfn, ul_hfn;
};
virtual void
initial_ue(uint16_t rnti, asn1::s1ap::rrc_establishment_cause_e cause, srslte::unique_byte_buffer_t pdu) = 0;
virtual void initial_ue(uint16_t rnti,
asn1::s1ap::rrc_establishment_cause_e cause,
srslte::unique_byte_buffer_t pdu,
uint32_t m_tmsi,
uint8_t mmec) = 0;
virtual void write_pdu(uint16_t rnti, srslte::unique_byte_buffer_t pdu) = 0;
virtual bool user_exists(uint16_t rnti) = 0;
virtual void user_mod(uint16_t old_rnti, uint16_t new_rnti) = 0;
virtual bool user_release(uint16_t rnti, asn1::s1ap::cause_radio_network_e cause_radio) = 0;
virtual void ue_ctxt_setup_complete(uint16_t rnti, const asn1::s1ap::init_context_setup_resp_s& res) = 0;
virtual void ue_erab_setup_complete(uint16_t rnti, const asn1::s1ap::erab_setup_resp_s& res) = 0;
virtual bool is_mme_connected() = 0;
/**
* Command the s1ap to transmit a HandoverRequired message to MME.
* This message initiates the S1 handover preparation procedure at the Source eNB
*
* @param rnti user to perform S1 handover
* @param target_eci eNB Id + Cell Id of the target eNB
* @param target_plmn PLMN of the target eNB
* @param rrc_container RRC container with SourceENBToTargetENBTransparentContainer message.
* @return true if successful
*/
virtual bool send_ho_required(uint16_t rnti,
uint32_t target_eci,
srslte::plmn_id_t target_plmn,
srslte::unique_byte_buffer_t rrc_container) = 0;
/**
* Command the s1ap to transmit eNBStatusTransfer message to MME. This message passes the PDCP context of the UE
* performing S1 handover from source eNB to target eNB.
*
* @param rnti user to perform S1 handover
* @param bearer_status_list PDCP SN and HFN status of the bearers to be preserved at target eNB
* @return true if successful
*/
virtual bool send_enb_status_transfer_proc(uint16_t rnti, std::vector<bearer_status_info>& bearer_status_list) = 0;
/* Acknowledge Handover Request message back to MME.
* This message signals the completion of the HandoverPreparation from the TeNB point of view. */
virtual bool send_ho_req_ack(const asn1::s1ap::ho_request_s& msg,
uint16_t rnti,
srslte::unique_byte_buffer_t ho_cmd,
srslte::span<asn1::s1ap::erab_admitted_item_s> admitted_bearers) = 0;
/**
* Notify MME that Handover is complete
*/
virtual void send_ho_notify(uint16_t rnti, uint64_t target_eci) = 0;
/**
* Cancel on-going S1 Handover. MME should release UE context in target eNB
* SeNB --> MME
*/
virtual void send_ho_cancel(uint16_t rnti) = 0;
/**
* Called during release of a subset of eNB E-RABs. Send E-RAB RELEASE INDICATION to MME.
* SeNB --> MME
*/
virtual bool release_erabs(uint16_t rnti, const std::vector<uint16_t>& erabs_successfully_released) = 0;
virtual bool send_ue_cap_info_indication(uint16_t rnti, srslte::unique_byte_buffer_t ue_radio_cap) = 0;
};
// Combined interface for PHY to access stack (MAC and RRC)
class stack_interface_phy_lte : public mac_interface_phy_lte
{
public:
virtual void tti_clock() = 0;
};
// Combined interface for stack (MAC and RRC) to access PHY
class phy_interface_stack_lte : public phy_interface_mac_lte, public phy_interface_rrc_lte
{};
typedef struct {
uint32_t enb_id; // 20-bit id (lsb bits)
uint8_t cell_id; // 8-bit cell id
uint16_t tac; // 16-bit tac
uint16_t mcc; // BCD-coded with 0xF filler
uint16_t mnc; // BCD-coded with 0xF filler
std::string mme_addr;
std::string gtp_bind_addr;
std::string s1c_bind_addr;
std::string enb_name;
} s1ap_args_t;
struct mac_args_t {
uint32_t nof_prb; ///< Needed to dimension MAC softbuffers for all cells
sched_interface::sched_args_t sched;
int nr_tb_size = -1;
uint32_t max_nof_ues;
};
class stack_interface_phy_lte;
class stack_interface_s1ap_lte
{

@ -0,0 +1,244 @@
/**
*
* \section COPYRIGHT
*
* Copyright 2013-2020 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 SRSLTE_ENB_MAC_INTERFACES_H
#define SRSLTE_ENB_MAC_INTERFACES_H
namespace srsenb {
struct mac_args_t {
uint32_t nof_prb; ///< Needed to dimension MAC softbuffers for all cells
sched_interface::sched_args_t sched;
int nr_tb_size = -1;
uint32_t max_nof_ues;
};
/* Interface PHY -> MAC */
class mac_interface_phy_lte
{
public:
const static int MAX_GRANTS = 64;
/**
* DL grant structure per UE
*/
struct dl_sched_grant_t {
srslte_dci_dl_t dci = {};
uint8_t* data[SRSLTE_MAX_TB] = {};
srslte_softbuffer_tx_t* softbuffer_tx[SRSLTE_MAX_TB] = {};
};
/**
* DL Scheduling result per cell/carrier
*/
typedef struct {
dl_sched_grant_t pdsch[MAX_GRANTS]; //< DL Grants
uint32_t nof_grants; //< Number of DL grants
uint32_t cfi; //< Current CFI of the cell, it can vary across cells
} dl_sched_t;
/**
* List of DL scheduling results, one entry per cell/carrier
*/
typedef std::vector<dl_sched_t> dl_sched_list_t;
typedef struct {
uint16_t rnti;
bool ack;
} ul_sched_ack_t;
/**
* UL grant information per UE
*/
typedef struct {
srslte_dci_ul_t dci;
uint32_t pid;
uint32_t current_tx_nb;
uint8_t* data;
bool needs_pdcch;
srslte_softbuffer_rx_t* softbuffer_rx;
} ul_sched_grant_t;
/**
* UL Scheduling result per cell/carrier
*/
typedef struct {
ul_sched_grant_t pusch[MAX_GRANTS];
ul_sched_ack_t phich[MAX_GRANTS];
uint32_t nof_grants;
uint32_t nof_phich;
} ul_sched_t;
/**
* List of UL scheduling results, one entry per cell/carrier
*/
typedef std::vector<ul_sched_t> ul_sched_list_t;
virtual int sr_detected(uint32_t tti, uint16_t rnti) = 0;
virtual void rach_detected(uint32_t tti, uint32_t primary_cc_idx, uint32_t preamble_idx, uint32_t time_adv) = 0;
/**
* PHY callback for giving MAC the Rank Indicator information of a given RNTI for an eNb cell/carrier.
*
* @param tti the given TTI
* @param rnti the UE identifier in the eNb
* @param cc_idx The eNb Cell/Carrier where the measurement corresponds
* @param ri_value the actual Rank Indicator value, 0 for 1 layer, 1 for two layers and so on.
* @return SRSLTE_SUCCESS if no error occurs, SRSLTE_ERROR* if an error occurs
*/
virtual int ri_info(uint32_t tti, uint16_t rnti, uint32_t cc_idx, uint32_t ri_value) = 0;
/**
* PHY callback for giving MAC the Pre-coding Matrix Indicator information of a given RNTI for an eNb cell/carrier.
*
* @param tti the given TTI
* @param rnti the UE identifier in the eNb
* @param cc_idx The eNb Cell/Carrier where the measurement corresponds
* @param pmi_value the actual PMI value
* @return SRSLTE_SUCCESS if no error occurs, SRSLTE_ERROR* if an error occurs
*/
virtual int pmi_info(uint32_t tti, uint16_t rnti, uint32_t cc_idx, uint32_t pmi_value) = 0;
/**
* PHY callback for for giving MAC the Channel Quality information of a given RNTI, TTI and eNb cell/carrier
* @param tti the given TTI
* @param rnti the UE identifier in the eNb
* @param cc_idx The eNb Cell/Carrier where the measurement corresponds
* @param cqi_value the corresponding Channel Quality Information
* @return SRSLTE_SUCCESS if no error occurs, SRSLTE_ERROR* if an error occurs
*/
virtual int cqi_info(uint32_t tti, uint16_t rnti, uint32_t cc_idx, uint32_t cqi_value) = 0;
typedef enum { PUSCH = 0, PUCCH, SRS } ul_channel_t;
/**
* PHY callback for giving MAC the SNR in dB of an UL transmission for a given RNTI at a given carrier
*
* @param tti The measurement was made
* @param rnti The UE identifier in the eNb
* @param cc_idx The eNb Cell/Carrier where the UL transmission was received
* @param snr_db The actual SNR of the received signal
* @param ch Indicates uplink channel (PUSCH, PUCCH or SRS)
* @return SRSLTE_SUCCESS if no error occurs, SRSLTE_ERROR* if an error occurs
*/
virtual int snr_info(uint32_t tti, uint16_t rnti, uint32_t cc_idx, float snr_db, ul_channel_t ch) = 0;
/**
* PHY callback for giving MAC the Time Aligment information in microseconds of a given RNTI during a TTI processing
*
* @param tti The measurement was made
* @param rnti The UE identifier in the eNb
* @param ta_us The actual time alignment in microseconds
* @return SRSLTE_SUCCESS if no error occurs, SRSLTE_ERROR* if an error occurs
*/
virtual int ta_info(uint32_t tti, uint16_t rnti, float ta_us) = 0;
/**
* PHY callback for giving MAC the HARQ DL ACK/NACK feedback information for a given RNTI, TTI, eNb cell/carrier and
* Transport block.
*
* @param tti the given TTI
* @param rnti the UE identifier in the eNb
* @param cc_idx the eNb Cell/Carrier identifier
* @param tb_idx the transport block index
* @param ack true for ACK, false for NACK, do not call for DTX
* @return SRSLTE_SUCCESS if no error occurs, SRSLTE_ERROR* if an error occurs
*/
virtual int ack_info(uint32_t tti, uint16_t rnti, uint32_t cc_idx, uint32_t tb_idx, bool ack) = 0;
/**
* Informs MAC about a received PUSCH transmission for given RNTI, TTI and eNb Cell/carrier.
*
* This function does not deallocate the uplink buffer. The function push_pdu() must be called after this
* to inform the MAC that the uplink buffer can be discarded or pushed to the stack
*
* @param tti the given TTI
* @param rnti the UE identifier in the eNb
* @param cc_idx the eNb Cell/Carrier identifier
* @param nof_bytes the number of grants carrierd by the PUSCH message
* @param crc_res the CRC check, set to true if the message was decoded succesfully
* @return SRSLTE_SUCCESS if no error occurs, SRSLTE_ERROR* if an error occurs
*/
virtual int crc_info(uint32_t tti, uint16_t rnti, uint32_t cc_idx, uint32_t nof_bytes, bool crc_res) = 0;
/**
* Pushes an uplink PDU through the stack if crc_res==true or discards it if crc_res==false
*
* @param tti the given TTI
* @param rnti the UE identifier in the eNb
* @param enb_cc_idx the eNb Cell/Carrier identifier
* @param nof_bytes the number of grants carrierd by the PUSCH message
* @param crc_res the CRC check, set to true if the message was decoded succesfully
* @return SRSLTE_SUCCESS if no error occurs, SRSLTE_ERROR* if an error occurs
*/
virtual int push_pdu(uint32_t tti_rx, uint16_t rnti, uint32_t enb_cc_idx, uint32_t nof_bytes, bool crc_res) = 0;
virtual int get_dl_sched(uint32_t tti, dl_sched_list_t& dl_sched_res) = 0;
virtual int get_mch_sched(uint32_t tti, bool is_mcch, dl_sched_list_t& dl_sched_res) = 0;
virtual int get_ul_sched(uint32_t tti, ul_sched_list_t& ul_sched_res) = 0;
virtual void set_sched_dl_tti_mask(uint8_t* tti_mask, uint32_t nof_sfs) = 0;
};
class mac_interface_rlc
{
public:
virtual int rlc_buffer_state(uint16_t rnti, uint32_t lc_id, uint32_t tx_queue, uint32_t retx_queue) = 0;
};
class mac_interface_rrc
{
public:
/* Provides cell configuration including SIB periodicity, etc. */
virtual int cell_cfg(const std::vector<sched_interface::cell_cfg_t>& cell_cfg) = 0;
virtual void reset() = 0;
/* Manages UE configuration context */
virtual int ue_cfg(uint16_t rnti, sched_interface::ue_cfg_t* cfg) = 0;
virtual int ue_rem(uint16_t rnti) = 0;
/**
* Called after Msg3 reception to set the UE C-RNTI, resolve contention, and alter the UE's configuration in the
* scheduler and phy.
*
* @param temp_crnti temporary C-RNTI of the UE
* @param crnti chosen C-RNTI for the UE
* @param cfg new UE scheduler configuration
*/
virtual int ue_set_crnti(uint16_t temp_crnti, uint16_t crnti, sched_interface::ue_cfg_t* cfg) = 0;
/* Manages UE bearers and associated configuration */
virtual int bearer_ue_cfg(uint16_t rnti, uint32_t lc_id, sched_interface::ue_bearer_cfg_t* cfg) = 0;
virtual int bearer_ue_rem(uint16_t rnti, uint32_t lc_id) = 0;
virtual void phy_config_enabled(uint16_t rnti, bool enabled) = 0;
virtual void write_mcch(const srslte::sib2_mbms_t* sib2_,
const srslte::sib13_t* sib13_,
const srslte::mcch_msg_t* mcch_,
const uint8_t* mcch_payload,
const uint8_t mcch_payload_length) = 0;
/**
* Allocate a C-RNTI for a new user, without adding it to the phy layer and scheduler yet
* @return value of the allocated C-RNTI
*/
virtual uint16_t reserve_new_crnti(const sched_interface::ue_cfg_t& ue_cfg) = 0;
};
// Combined interface for PHY to access stack (MAC and RRC)
class stack_interface_phy_lte : public mac_interface_phy_lte
{
public:
virtual void tti_clock() = 0;
};
} // namespace srsenb
#endif // SRSLTE_ENB_MAC_INTERFACES_H

@ -0,0 +1,91 @@
/**
*
* \section COPYRIGHT
*
* Copyright 2013-2020 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 "srslte/asn1/s1ap_utils.h"
#include "srslte/interfaces/enb_rrc_interface_types.h"
#ifndef SRSLTE_ENB_RRC_INTERFACES_H
#define SRSLTE_ENB_RRC_INTERFACES_H
namespace srsenb {
// RRC interface for S1AP
class rrc_interface_s1ap
{
public:
virtual void write_dl_info(uint16_t rnti, srslte::unique_byte_buffer_t sdu) = 0;
virtual void release_complete(uint16_t rnti) = 0;
virtual bool setup_ue_ctxt(uint16_t rnti, const asn1::s1ap::init_context_setup_request_s& msg) = 0;
virtual bool modify_ue_ctxt(uint16_t rnti, const asn1::s1ap::ue_context_mod_request_s& msg) = 0;
virtual bool setup_ue_erabs(uint16_t rnti, const asn1::s1ap::erab_setup_request_s& msg) = 0;
virtual void modify_erabs(uint16_t rnti,
const asn1::s1ap::erab_modify_request_s& msg,
std::vector<uint16_t>* erabs_modified,
std::vector<uint16_t>* erabs_failed_to_modify) = 0;
virtual bool release_erabs(uint32_t rnti) = 0;
virtual void release_erabs(uint32_t rnti,
const asn1::s1ap::erab_release_cmd_s& msg,
std::vector<uint16_t>* erabs_released,
std::vector<uint16_t>* erabs_failed_to_release) = 0;
virtual void add_paging_id(uint32_t ueid, const asn1::s1ap::ue_paging_id_c& ue_paging_id) = 0;
/**
* Reports the reception of S1 HandoverCommand / HandoverPreparationFailure or abnormal conditions during
* S1 Handover preparation back to RRC.
*
* @param rnti user
* @param is_success true if ho cmd was received
* @param container TargeteNB RRCConnectionReconfiguration message with MobilityControlInfo
*/
virtual void ho_preparation_complete(uint16_t rnti,
bool is_success,
const asn1::s1ap::ho_cmd_s& msg,
srslte::unique_byte_buffer_t container) = 0;
virtual uint16_t
start_ho_ue_resource_alloc(const asn1::s1ap::ho_request_s& msg,
const asn1::s1ap::sourceenb_to_targetenb_transparent_container_s& container) = 0;
virtual void set_erab_status(uint16_t rnti, const asn1::s1ap::bearers_subject_to_status_transfer_list_l& erabs) = 0;
};
/// RRC interface for RLC
class rrc_interface_rlc
{
public:
virtual void read_pdu_pcch(uint8_t* payload, uint32_t payload_size) = 0;
virtual void max_retx_attempted(uint16_t rnti) = 0;
virtual void write_pdu(uint16_t rnti, uint32_t lcid, srslte::unique_byte_buffer_t sdu) = 0;
};
/// RRC interface for MAC
class rrc_interface_mac
{
public:
/* Radio Link failure */
virtual int add_user(uint16_t rnti, const sched_interface::ue_cfg_t& init_ue_cfg) = 0;
virtual void upd_user(uint16_t new_rnti, uint16_t old_rnti) = 0;
virtual void set_activity_user(uint16_t rnti) = 0;
virtual bool is_paging_opportunity(uint32_t tti, uint32_t* payload_len) = 0;
///< Provide packed SIB to MAC (buffer is managed by RRC)
virtual uint8_t* read_pdu_bcch_dlsch(const uint8_t enb_cc_idx, const uint32_t sib_index) = 0;
};
/// RRC interface for PDCP
class rrc_interface_pdcp
{
public:
virtual void write_pdu(uint16_t rnti, uint32_t lcid, srslte::unique_byte_buffer_t pdu) = 0;
};
} // namespace srsenb
#endif // SRSLTE_ENB_RRC_INTERFACES_H

@ -0,0 +1,113 @@
/**
*
* \section COPYRIGHT
*
* Copyright 2013-2020 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 "srslte/asn1/s1ap_utils.h"
#include "srslte/interfaces/rrc_interface_types.h"
#ifndef SRSLTE_ENB_S1AP_INTERFACES_H
#define SRSLTE_ENB_S1AP_INTERFACES_H
namespace srsenb {
struct s1ap_args_t {
uint32_t enb_id; // 20-bit id (lsb bits)
uint8_t cell_id; // 8-bit cell id
uint16_t tac; // 16-bit tac
uint16_t mcc; // BCD-coded with 0xF filler
uint16_t mnc; // BCD-coded with 0xF filler
std::string mme_addr;
std::string gtp_bind_addr;
std::string s1c_bind_addr;
std::string enb_name;
};
// S1AP interface for RRC
class s1ap_interface_rrc
{
public:
struct bearer_status_info {
uint8_t erab_id;
uint16_t pdcp_dl_sn, pdcp_ul_sn;
uint16_t dl_hfn, ul_hfn;
};
virtual void
initial_ue(uint16_t rnti, asn1::s1ap::rrc_establishment_cause_e cause, srslte::unique_byte_buffer_t pdu) = 0;
virtual void initial_ue(uint16_t rnti,
asn1::s1ap::rrc_establishment_cause_e cause,
srslte::unique_byte_buffer_t pdu,
uint32_t m_tmsi,
uint8_t mmec) = 0;
virtual void write_pdu(uint16_t rnti, srslte::unique_byte_buffer_t pdu) = 0;
virtual bool user_exists(uint16_t rnti) = 0;
virtual void user_mod(uint16_t old_rnti, uint16_t new_rnti) = 0;
virtual bool user_release(uint16_t rnti, asn1::s1ap::cause_radio_network_e cause_radio) = 0;
virtual void ue_ctxt_setup_complete(uint16_t rnti, const asn1::s1ap::init_context_setup_resp_s& res) = 0;
virtual void ue_erab_setup_complete(uint16_t rnti, const asn1::s1ap::erab_setup_resp_s& res) = 0;
virtual bool is_mme_connected() = 0;
/**
* Command the s1ap to transmit a HandoverRequired message to MME.
* This message initiates the S1 handover preparation procedure at the Source eNB
*
* @param rnti user to perform S1 handover
* @param target_eci eNB Id + Cell Id of the target eNB
* @param target_plmn PLMN of the target eNB
* @param rrc_container RRC container with SourceENBToTargetENBTransparentContainer message.
* @return true if successful
*/
virtual bool send_ho_required(uint16_t rnti,
uint32_t target_eci,
srslte::plmn_id_t target_plmn,
srslte::unique_byte_buffer_t rrc_container) = 0;
/**
* Command the s1ap to transmit eNBStatusTransfer message to MME. This message passes the PDCP context of the UE
* performing S1 handover from source eNB to target eNB.
*
* @param rnti user to perform S1 handover
* @param bearer_status_list PDCP SN and HFN status of the bearers to be preserved at target eNB
* @return true if successful
*/
virtual bool send_enb_status_transfer_proc(uint16_t rnti, std::vector<bearer_status_info>& bearer_status_list) = 0;
/* Acknowledge Handover Request message back to MME.
* This message signals the completion of the HandoverPreparation from the TeNB point of view. */
virtual bool send_ho_req_ack(const asn1::s1ap::ho_request_s& msg,
uint16_t rnti,
srslte::unique_byte_buffer_t ho_cmd,
srslte::span<asn1::s1ap::erab_admitted_item_s> admitted_bearers) = 0;
/**
* Notify MME that Handover is complete
*/
virtual void send_ho_notify(uint16_t rnti, uint64_t target_eci) = 0;
/**
* Cancel on-going S1 Handover. MME should release UE context in target eNB
* SeNB --> MME
*/
virtual void send_ho_cancel(uint16_t rnti) = 0;
/**
* Called during release of a subset of eNB E-RABs. Send E-RAB RELEASE INDICATION to MME.
* SeNB --> MME
*/
virtual bool release_erabs(uint16_t rnti, const std::vector<uint16_t>& erabs_successfully_released) = 0;
virtual bool send_ue_cap_info_indication(uint16_t rnti, srslte::unique_byte_buffer_t ue_radio_cap) = 0;
};
} // namespace srsenb
#endif // SRSLTE_ENB_S1AP_INTERFACES_H

@ -14,10 +14,11 @@
#define SRSENB_PHY_UE_DB_H_
#include "phy_interfaces.h"
#include "srslte/interfaces/enb_interfaces.h"
#include "srslte/interfaces/enb_mac_interfaces.h"
#include <map>
#include <mutex>
#include <srslte/adt/circular_array.h>
#include <srslte/interfaces/enb_interfaces.h>
#include <srslte/srslte.h>
namespace srsenb {
@ -75,14 +76,14 @@ private:
* Cell information for the UE database
*/
typedef struct {
cell_state_t state = cell_state_none; ///< Configuration state
uint32_t enb_cc_idx = 0; ///< Corresponding eNb cell/carrier index
uint8_t last_ri = 0; ///< Last reported rank indicator
cell_state_t state = cell_state_none; ///< Configuration state
uint32_t enb_cc_idx = 0; ///< Corresponding eNb cell/carrier index
uint8_t last_ri = 0; ///< Last reported rank indicator
srslte::circular_array<srslte_ra_tb_t, SRSLTE_MAX_HARQ_PROC> last_tb =
{}; ///< Stores last PUSCH Resource allocation
bool stash_use_tbs_index_alt = false;
srslte::phy_cfg_t phy_cfg; ///< Configuration, it has a default constructor
srslte::circular_array<bool, TTIMOD_SZ> is_grant_available; ///< Indicates whether there is an available grant
{}; ///< Stores last PUSCH Resource allocation
bool stash_use_tbs_index_alt = false;
srslte::phy_cfg_t phy_cfg; ///< Configuration, it has a default constructor
srslte::circular_array<bool, TTIMOD_SZ> is_grant_available; ///< Indicates whether there is an available grant
} cell_info_t;
/**

@ -14,6 +14,8 @@
#define SRSLTE_ENB_STACK_BASE_H
#include "srslte/interfaces/enb_interfaces.h"
#include "srslte/interfaces/enb_mac_interfaces.h"
#include "srslte/interfaces/enb_s1ap_interfaces.h"
#include "srsue/hdr/stack/upper/gw.h"
#include <string>

@ -28,7 +28,6 @@
#include "enb_stack_base.h"
#include "srslte/interfaces/enb_interfaces.h"
#include "srslte/interfaces/enb_rrc_interface_types.h"
#include "srslte/srslog/srslog.h"
namespace srsenb {

@ -21,6 +21,7 @@
#include "srslte/common/threads.h"
#include "srslte/common/tti_sync_cv.h"
#include "srslte/interfaces/enb_interfaces.h"
#include "srslte/interfaces/enb_mac_interfaces.h"
#include "srslte/interfaces/enb_metrics_interface.h"
#include "srslte/interfaces/enb_rrc_interface_types.h"
#include "srslte/interfaces/sched_interface.h"
@ -148,7 +149,7 @@ private:
uint32_t pdu_len,
uint32_t tti);
const static int rar_payload_len = 128;
const static int rar_payload_len = 128;
std::array<srslte::rar_pdu, sched_interface::MAX_RAR_LIST> rar_pdu_msg;
srslte::byte_buffer_t rar_payload[SRSLTE_MAX_CARRIERS][sched_interface::MAX_RAR_LIST];

@ -25,6 +25,8 @@
namespace srsenb {
class rrc_interface_mac;
class sched : public sched_interface
{
public:

@ -14,8 +14,8 @@
#define SRSENB_UE_H
#include "mac_metrics.h"
#include "srslte/common/block_queue.h"
#include "srslte/adt/circular_array.h"
#include "srslte/common/block_queue.h"
#include "srslte/common/log.h"
#include "srslte/common/mac_pcap.h"
#include "srslte/interfaces/enb_interfaces.h"
@ -29,6 +29,8 @@
namespace srsenb {
class rrc_interface_mac;
class ue : public srslte::read_pdu_interface, public srslte::pdu_queue::process_callback, public mac_ta_ue_interface
{
public:

@ -20,6 +20,8 @@
namespace srsenb {
class mac_interface_rrc;
class mac_controller
{
using ue_cfg_t = sched_interface::ue_cfg_t;

@ -25,13 +25,16 @@
#include "srslte/common/stack_procedure.h"
#include "srslte/common/task_scheduler.h"
#include "srslte/common/timeout.h"
#include "srslte/interfaces/enb_interfaces.h"
#include "srslte/interfaces/enb_rrc_interfaces.h"
#include "srslte/srslog/srslog.h"
#include <map>
#include <queue>
namespace srsenb {
class s1ap_interface_rrc;
class mac_interface_rrc;
static const char rrc_state_text[RRC_STATE_N_ITEMS][100] = {"IDLE",
"WAIT FOR CON SETUP COMPLETE",
"WAIT FOR SECURITY MODE COMPLETE",

@ -22,6 +22,8 @@
namespace srsenb {
class rrc_interface_pdcp;
class pdcp : public pdcp_interface_rlc, public pdcp_interface_gtpu, public pdcp_interface_rrc
{
public:

@ -29,6 +29,10 @@ typedef struct {
namespace srsenb {
class rrc_interface_rlc;
class pdcp_interface_rlc;
class mac_interface_rlc;
class rlc : public rlc_interface_mac, public rlc_interface_rrc, public rlc_interface_pdcp
{
public:

@ -22,6 +22,7 @@
#include "srslte/common/s1ap_pcap.h"
#include "srslte/common/threads.h"
#include "srslte/interfaces/enb_interfaces.h"
#include "srslte/interfaces/enb_s1ap_interfaces.h"
#include "s1ap_metrics.h"
#include "srslte/asn1/s1ap.h"
@ -33,6 +34,8 @@
namespace srsenb {
class rrc_interface_s1ap;
struct ue_ctxt_t {
static const uint32_t invalid_enb_id = std::numeric_limits<uint32_t>::max();

@ -11,6 +11,7 @@
*/
#include "srsenb/hdr/phy/prach_worker.h"
#include "srslte/interfaces/enb_mac_interfaces.h"
#include "srslte/srslte.h"
namespace srsenb {

@ -13,14 +13,12 @@
#include <pthread.h>
#include <srslte/interfaces/sched_interface.h>
#include <string.h>
#include <strings.h>
#include <unistd.h>
#include "srsenb/hdr/stack/mac/mac.h"
#include "srslte/common/log.h"
#include "srslte/common/log_helper.h"
#include "srslte/common/rwlock_guard.h"
#include "srslte/common/time_prof.h"
#include "srslte/interfaces/enb_rrc_interfaces.h"
//#define WRITE_SIB_PCAP
using namespace asn1::rrc;
@ -810,9 +808,9 @@ int mac::get_mch_sched(uint32_t tti, bool is_mcch, dl_sched_list_t& dl_sched_res
int requested_bytes = (mcs_data.tbs / 8 > (int)mch.mtch_sched[mtch_index].lcid_buffer_size)
? (mch.mtch_sched[mtch_index].lcid_buffer_size)
: ((mcs_data.tbs / 8) - 2);
int bytes_received = ue_db[SRSLTE_MRNTI]->read_pdu(current_lcid, mtch_payload_buffer, requested_bytes);
mch.pdu[0].lcid = current_lcid;
mch.pdu[0].nbytes = bytes_received;
int bytes_received = ue_db[SRSLTE_MRNTI]->read_pdu(current_lcid, mtch_payload_buffer, requested_bytes);
mch.pdu[0].lcid = current_lcid;
mch.pdu[0].nbytes = bytes_received;
mch.mtch_sched[0].mtch_payload = mtch_payload_buffer;
dl_sched_res->pdsch[0].dci.rnti = SRSLTE_MRNTI;
if (bytes_received) {

@ -15,6 +15,7 @@
#include "srsenb/hdr/stack/mac/schedulers/sched_time_pf.h"
#include "srsenb/hdr/stack/mac/schedulers/sched_time_rr.h"
#include "srslte/common/logmap.h"
#include "srslte/interfaces/enb_rrc_interfaces.h"
namespace srsenb {
@ -234,7 +235,6 @@ void ra_sched::ul_sched(sf_sched* sf_dl_sched, sf_sched* sf_msg3_sched)
for (const auto& rar : alloc_rars) {
for (const auto& msg3grant : rar.rar_grant.msg3_grant) {
uint16_t crnti = msg3grant.data.temp_crnti;
auto user_it = ue_db->find(crnti);
if (user_it != ue_db->end() and sf_msg3_sched->alloc_msg3(&user_it->second, msg3grant)) {

@ -18,6 +18,7 @@
#include "srsenb/hdr/stack/mac/ue.h"
#include "srslte/common/log_helper.h"
#include "srslte/interfaces/enb_interfaces.h"
#include "srslte/interfaces/enb_rrc_interfaces.h"
namespace srsenb {

@ -13,6 +13,7 @@
#include "srsenb/hdr/stack/rrc/mac_controller.h"
#include "srsenb/hdr/stack/upper/common_enb.h"
#include "srslte/asn1/rrc_utils.h"
#include "srslte/interfaces/enb_mac_interfaces.h"
namespace srsenb {
@ -423,7 +424,6 @@ void ue_cfg_apply_reconf_complete_updates(ue_cfg_t& ue_cfg,
conn_recfg.non_crit_ext.non_crit_ext.non_crit_ext_present and
conn_recfg.non_crit_ext.non_crit_ext.non_crit_ext.scell_to_add_mod_list_r10_present) {
for (const auto& scell : conn_recfg.non_crit_ext.non_crit_ext.non_crit_ext.scell_to_add_mod_list_r10) {
// Resize MAC SCell list if required
if (scell.scell_idx_r10 >= ue_cfg.supported_cc_list.size()) {
ue_cfg.supported_cc_list.resize(scell.scell_idx_r10 + 1);

@ -17,6 +17,7 @@
#include "srslte/asn1/rrc_utils.h"
#include "srslte/common/bcd_helpers.h"
#include "srslte/common/int_helpers.h"
#include "srslte/interfaces/enb_mac_interfaces.h"
#include "srslte/interfaces/sched_interface.h"
#include "srslte/srslte.h"

@ -19,6 +19,8 @@
#include "srslte/common/bcd_helpers.h"
#include "srslte/common/common.h"
#include "srslte/common/int_helpers.h"
#include "srslte/interfaces/enb_mac_interfaces.h"
#include "srslte/interfaces/enb_s1ap_interfaces.h"
#include "srslte/rrc/rrc_cfg_utils.h"
#include <algorithm>
#include <cstdio>

@ -18,6 +18,7 @@
#include "srslte/asn1/rrc_utils.h"
#include "srslte/common/enb_events.h"
#include "srslte/common/int_helpers.h"
#include "srslte/interfaces/enb_s1ap_interfaces.h"
using namespace asn1::rrc;

@ -12,6 +12,7 @@
#include "srsenb/hdr/stack/upper/pdcp.h"
#include "srsenb/hdr/stack/upper/common_enb.h"
#include "srslte/interfaces/enb_rrc_interfaces.h"
namespace srsenb {

@ -12,6 +12,8 @@
#include "srsenb/hdr/stack/upper/rlc.h"
#include "srsenb/hdr/stack/upper/common_enb.h"
#include "srslte/interfaces/enb_mac_interfaces.h"
#include "srslte/interfaces/enb_rrc_interfaces.h"
namespace srsenb {

@ -17,6 +17,7 @@
#include "srslte/common/enb_events.h"
#include "srslte/common/int_helpers.h"
#include "srslte/common/logmap.h"
#include "srslte/interfaces/enb_rrc_interfaces.h"
#include <arpa/inet.h> //for inet_ntop()
#include <inttypes.h>

@ -14,6 +14,9 @@
#define SRSENB_DUMMY_CLASSES_H
#include "srslte/interfaces/enb_interfaces.h"
#include "srslte/interfaces/enb_mac_interfaces.h"
#include "srslte/interfaces/enb_rrc_interfaces.h"
#include "srslte/interfaces/enb_s1ap_interfaces.h"
namespace srsenb {

Loading…
Cancel
Save