mirror of https://github.com/pvnis/srsRAN_4G.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
312 lines
11 KiB
C
312 lines
11 KiB
C
4 years ago
|
/**
|
||
8 years ago
|
*
|
||
4 years ago
|
* \section COPYRIGHT
|
||
8 years ago
|
*
|
||
4 years ago
|
* Copyright 2013-2021 Software Radio Systems Limited
|
||
8 years ago
|
*
|
||
4 years ago
|
* 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.
|
||
8 years ago
|
*
|
||
|
*/
|
||
8 years ago
|
|
||
3 years ago
|
#include "common/sched_config.h"
|
||
4 years ago
|
#include "srsran/adt/bounded_vector.h"
|
||
|
#include "srsran/common/common.h"
|
||
|
#include "srsran/srsran.h"
|
||
5 years ago
|
#include <vector>
|
||
8 years ago
|
|
||
4 years ago
|
#ifndef SRSRAN_SCHED_INTERFACE_H
|
||
|
#define SRSRAN_SCHED_INTERFACE_H
|
||
8 years ago
|
|
||
|
namespace srsenb {
|
||
|
|
||
|
class sched_interface
|
||
|
{
|
||
6 years ago
|
public:
|
||
5 years ago
|
virtual ~sched_interface() = default;
|
||
5 years ago
|
|
||
6 years ago
|
const static uint32_t max_cce = 128;
|
||
|
const static uint32_t max_prb = 100;
|
||
|
const static uint32_t max_rbg = 25;
|
||
|
|
||
5 years ago
|
const static int MAX_SIB_PAYLOAD_LEN = 2048;
|
||
8 years ago
|
const static int MAX_SIBS = 16;
|
||
4 years ago
|
const static int MAX_LC = 11;
|
||
4 years ago
|
const static int MAX_LC_GROUP = 4;
|
||
8 years ago
|
const static int MAX_DATA_LIST = 32;
|
||
|
const static int MAX_RAR_LIST = 8;
|
||
|
const static int MAX_BC_LIST = 8;
|
||
|
const static int MAX_RLC_PDU_LIST = 8;
|
||
5 years ago
|
const static int MAX_PHICH_LIST = 8;
|
||
|
|
||
8 years ago
|
typedef struct {
|
||
5 years ago
|
uint32_t len;
|
||
|
uint32_t period_rf;
|
||
8 years ago
|
} cell_cfg_sib_t;
|
||
5 years ago
|
|
||
5 years ago
|
struct sched_args_t {
|
||
4 years ago
|
std::string sched_policy = "time_pf";
|
||
|
std::string sched_policy_args = "2";
|
||
|
int pdsch_mcs = -1;
|
||
|
int pdsch_max_mcs = 28;
|
||
|
int pusch_mcs = -1;
|
||
|
int pusch_max_mcs = 28;
|
||
|
uint32_t min_nof_ctrl_symbols = 1;
|
||
|
uint32_t max_nof_ctrl_symbols = 3;
|
||
4 years ago
|
int min_aggr_level = 0;
|
||
4 years ago
|
int max_aggr_level = 3;
|
||
3 years ago
|
bool adaptive_aggr_level = false;
|
||
4 years ago
|
bool pucch_mux_enabled = false;
|
||
|
float target_bler = 0.05;
|
||
|
float max_delta_dl_cqi = 5;
|
||
|
float max_delta_ul_snr = 5;
|
||
|
float adaptive_link_step_size = 0.001;
|
||
4 years ago
|
uint32_t min_tpc_tti_interval = 1;
|
||
3 years ago
|
float ul_snr_avg_alpha = 0.05;
|
||
|
int init_ul_snr_value = 5;
|
||
3 years ago
|
int init_dl_cqi = 5;
|
||
3 years ago
|
float max_sib_coderate = 0.8;
|
||
3 years ago
|
int pdcch_cqi_offset = 0;
|
||
5 years ago
|
};
|
||
8 years ago
|
|
||
5 years ago
|
struct cell_cfg_t {
|
||
8 years ago
|
// Main cell configuration (used to calculate DCI locations in scheduler)
|
||
4 years ago
|
srsran_cell_t cell;
|
||
5 years ago
|
|
||
8 years ago
|
/* SIB configuration */
|
||
5 years ago
|
cell_cfg_sib_t sibs[MAX_SIBS];
|
||
|
uint32_t si_window_ms;
|
||
|
|
||
4 years ago
|
/* pucch configuration */
|
||
|
float target_pucch_ul_sinr;
|
||
|
|
||
8 years ago
|
/* pusch configuration */
|
||
4 years ago
|
srsran_pusch_hopping_cfg_t pusch_hopping_cfg;
|
||
4 years ago
|
float target_pusch_ul_sinr;
|
||
3 years ago
|
int min_phr_thres;
|
||
4 years ago
|
bool enable_phr_handling;
|
||
|
bool enable_64qam;
|
||
5 years ago
|
|
||
8 years ago
|
/* prach configuration */
|
||
5 years ago
|
uint32_t prach_config;
|
||
|
uint32_t prach_nof_preambles;
|
||
5 years ago
|
uint32_t prach_freq_offset;
|
||
8 years ago
|
uint32_t prach_rar_window;
|
||
5 years ago
|
uint32_t prach_contention_resolution_timer;
|
||
|
|
||
8 years ago
|
uint32_t maxharq_msg3tx;
|
||
|
uint32_t n1pucch_an;
|
||
5 years ago
|
uint32_t delta_pucch_shift;
|
||
6 years ago
|
|
||
|
// If non-negative, statically allocate N prbs at the edges of the uplink for PUCCH
|
||
5 years ago
|
int nrb_pucch;
|
||
6 years ago
|
|
||
5 years ago
|
uint32_t nrb_cqi;
|
||
8 years ago
|
uint32_t ncs_an;
|
||
5 years ago
|
|
||
8 years ago
|
uint32_t srs_subframe_config;
|
||
5 years ago
|
uint32_t srs_subframe_offset;
|
||
|
uint32_t srs_bw_config;
|
||
|
|
||
5 years ago
|
struct scell_cfg_t {
|
||
|
uint32_t enb_cc_idx = 0;
|
||
|
bool cross_carrier_scheduling = false;
|
||
|
bool ul_allowed = false;
|
||
|
};
|
||
|
std::vector<scell_cfg_t> scell_list;
|
||
|
};
|
||
5 years ago
|
|
||
5 years ago
|
struct ant_info_ded_t {
|
||
5 years ago
|
enum class tx_mode_t { tm1, tm2, tm3, tm4, tm5, tm6, tm7, tm8_v920, nulltype } tx_mode = tx_mode_t::tm1;
|
||
5 years ago
|
enum class codebook_t {
|
||
|
n2_tx_ant_tm3,
|
||
|
n4_tx_ant_tm3,
|
||
|
n2_tx_ant_tm4,
|
||
|
n4_tx_ant_tm4,
|
||
|
n2_tx_ant_tm5,
|
||
|
n4_tx_ant_tm5,
|
||
|
n2_tx_ant_tm6,
|
||
|
n4_tx_ant_tm6,
|
||
|
none
|
||
5 years ago
|
} cookbook_subset_type = codebook_t::none;
|
||
5 years ago
|
uint64_t codebook_subset_restrict;
|
||
5 years ago
|
enum class ue_tx_ant_sel_t { release, closed_loop, open_loop } ue_tx_ant_sel = ue_tx_ant_sel_t::release;
|
||
5 years ago
|
};
|
||
|
|
||
5 years ago
|
struct ue_cfg_t {
|
||
5 years ago
|
struct cc_cfg_t {
|
||
4 years ago
|
bool active = false;
|
||
|
uint32_t enb_cc_idx = 0; ///< eNB CC index
|
||
4 years ago
|
srsran_dl_cfg_t dl_cfg = {};
|
||
4 years ago
|
uint32_t aperiodic_cqi_period = 0; // if 0 is periodic CQI
|
||
5 years ago
|
};
|
||
8 years ago
|
/* ue capabilities, etc */
|
||
4 years ago
|
uint32_t maxharq_tx = 5;
|
||
|
bool continuous_pusch = false;
|
||
4 years ago
|
srsran_uci_offset_cfg_t uci_offset = {15, 12, 10};
|
||
|
srsran_pucch_cfg_t pucch_cfg = {};
|
||
3 years ago
|
std::array<mac_lc_ch_cfg_t, MAX_LC> ue_bearers = {};
|
||
5 years ago
|
std::vector<cc_cfg_t> supported_cc_list; ///< list of UE supported CCs. First index for PCell
|
||
5 years ago
|
ant_info_ded_t dl_ant_info;
|
||
5 years ago
|
bool use_tbs_index_alt = false;
|
||
4 years ago
|
uint32_t measgap_period = 0;
|
||
|
uint32_t measgap_offset = 0;
|
||
4 years ago
|
enum class ul64qam_cap { undefined, disabled, enabled };
|
||
|
ul64qam_cap support_ul64qam = ul64qam_cap::undefined;
|
||
5 years ago
|
};
|
||
5 years ago
|
|
||
8 years ago
|
typedef struct {
|
||
5 years ago
|
uint32_t lcid;
|
||
8 years ago
|
uint32_t nbytes;
|
||
5 years ago
|
} dl_sched_pdu_t;
|
||
|
|
||
7 years ago
|
typedef struct {
|
||
6 years ago
|
uint32_t lcid;
|
||
|
uint32_t lcid_buffer_size;
|
||
|
uint32_t stop;
|
||
|
uint8_t* mtch_payload;
|
||
7 years ago
|
} dl_mtch_sched_t;
|
||
5 years ago
|
|
||
7 years ago
|
typedef struct {
|
||
5 years ago
|
dl_sched_pdu_t pdu[20];
|
||
7 years ago
|
dl_mtch_sched_t mtch_sched[8];
|
||
5 years ago
|
uint32_t num_mtch_sched;
|
||
|
uint8_t* mcch_payload;
|
||
|
uint32_t current_sf_allocation_num;
|
||
|
} dl_pdu_mch_t;
|
||
|
|
||
5 years ago
|
struct dl_sched_data_t {
|
||
4 years ago
|
srsran_dci_dl_t dci;
|
||
|
uint32_t tbs[SRSRAN_MAX_TB];
|
||
5 years ago
|
bool mac_ce_ta;
|
||
|
bool mac_ce_rnti;
|
||
4 years ago
|
uint32_t nof_pdu_elems[SRSRAN_MAX_TB];
|
||
|
dl_sched_pdu_t pdu[SRSRAN_MAX_TB][MAX_RLC_PDU_LIST];
|
||
5 years ago
|
};
|
||
5 years ago
|
|
||
8 years ago
|
typedef struct {
|
||
6 years ago
|
bool needs_pdcch;
|
||
|
uint32_t current_tx_nb;
|
||
|
uint32_t tbs;
|
||
4 years ago
|
srsran_dci_ul_t dci;
|
||
8 years ago
|
} ul_sched_data_t;
|
||
5 years ago
|
|
||
5 years ago
|
struct dl_sched_rar_info_t {
|
||
5 years ago
|
uint32_t preamble_idx;
|
||
|
uint32_t ta_cmd;
|
||
|
uint16_t temp_crnti;
|
||
|
uint32_t msg3_size;
|
||
|
uint32_t prach_tti;
|
||
5 years ago
|
};
|
||
5 years ago
|
|
||
8 years ago
|
typedef struct {
|
||
5 years ago
|
dl_sched_rar_info_t data;
|
||
4 years ago
|
srsran_dci_rar_grant_t grant;
|
||
8 years ago
|
} dl_sched_rar_grant_t;
|
||
5 years ago
|
|
||
4 years ago
|
struct dl_sched_rar_t {
|
||
|
uint32_t tbs;
|
||
4 years ago
|
srsran_dci_dl_t dci;
|
||
|
srsran::bounded_vector<dl_sched_rar_grant_t, MAX_RAR_LIST> msg3_grant;
|
||
4 years ago
|
};
|
||
8 years ago
|
|
||
|
typedef struct {
|
||
4 years ago
|
srsran_dci_dl_t dci;
|
||
8 years ago
|
|
||
5 years ago
|
enum bc_type { BCCH, PCCH } type;
|
||
|
|
||
8 years ago
|
uint32_t index;
|
||
5 years ago
|
|
||
|
uint32_t tbs;
|
||
|
|
||
|
} dl_sched_bc_t;
|
||
|
|
||
4 years ago
|
struct dl_sched_res_t {
|
||
|
uint32_t cfi;
|
||
4 years ago
|
srsran::bounded_vector<dl_sched_data_t, MAX_DATA_LIST> data;
|
||
|
srsran::bounded_vector<dl_sched_rar_t, MAX_RAR_LIST> rar;
|
||
|
srsran::bounded_vector<dl_sched_bc_t, MAX_BC_LIST> bc;
|
||
4 years ago
|
};
|
||
5 years ago
|
|
||
8 years ago
|
typedef struct {
|
||
5 years ago
|
uint16_t rnti;
|
||
|
enum phich_elem { ACK, NACK } phich;
|
||
8 years ago
|
} ul_sched_phich_t;
|
||
|
|
||
4 years ago
|
struct ul_sched_res_t {
|
||
4 years ago
|
srsran::bounded_vector<ul_sched_data_t, MAX_DATA_LIST> pusch;
|
||
|
srsran::bounded_vector<ul_sched_phich_t, MAX_PHICH_LIST> phich;
|
||
4 years ago
|
};
|
||
5 years ago
|
|
||
8 years ago
|
/******************* Scheduler Control ****************************/
|
||
|
|
||
|
/* Provides cell configuration including SIB periodicity, etc. */
|
||
5 years ago
|
virtual int cell_cfg(const std::vector<cell_cfg_t>& cell_cfg) = 0;
|
||
|
virtual int reset() = 0;
|
||
8 years ago
|
|
||
|
/* Manages UE scheduling context */
|
||
5 years ago
|
virtual int ue_cfg(uint16_t rnti, const ue_cfg_t& cfg) = 0;
|
||
|
virtual int ue_rem(uint16_t rnti) = 0;
|
||
|
virtual bool ue_exists(uint16_t rnti) = 0;
|
||
8 years ago
|
|
||
|
/* Manages UE bearers and associated configuration */
|
||
3 years ago
|
virtual int bearer_ue_cfg(uint16_t rnti, uint32_t lc_id, const mac_lc_ch_cfg_t& cfg) = 0;
|
||
4 years ago
|
virtual int bearer_ue_rem(uint16_t rnti, uint32_t lc_id) = 0;
|
||
5 years ago
|
|
||
|
virtual uint32_t get_ul_buffer(uint16_t rnti) = 0;
|
||
|
virtual uint32_t get_dl_buffer(uint16_t rnti) = 0;
|
||
8 years ago
|
|
||
|
/******************* Scheduling Interface ***********************/
|
||
5 years ago
|
|
||
|
/**
|
||
|
* Update the current RLC buffer state for a given user and bearer.
|
||
|
*
|
||
|
* @param rnti user rnti
|
||
|
* @param lc_id logical channel id for which the buffer update is concerned
|
||
|
* @param tx_queue number of pending bytes for new DL RLC transmissions
|
||
|
* @param retx_queue number of pending bytes concerning RLC retransmissions
|
||
|
* @return error code
|
||
|
*/
|
||
5 years ago
|
virtual int dl_rlc_buffer_state(uint16_t rnti, uint32_t lc_id, uint32_t tx_queue, uint32_t retx_queue) = 0;
|
||
5 years ago
|
|
||
|
/**
|
||
|
* Enqueue MAC CEs for DL transmission
|
||
|
*
|
||
|
* @param rnti user rnti
|
||
|
* @param ce_code lcid of the MAC CE
|
||
|
* @param nof_cmds how many repetitions of the same MAC CE should be scheduled
|
||
|
* @return error code
|
||
|
*/
|
||
|
virtual int dl_mac_buffer_state(uint16_t rnti, uint32_t ce_code, uint32_t nof_cmds) = 0;
|
||
5 years ago
|
|
||
8 years ago
|
/* DL information */
|
||
3 years ago
|
virtual int dl_ack_info(uint32_t tti, uint16_t rnti, uint32_t enb_cc_idx, uint32_t tb_idx, bool ack) = 0;
|
||
|
virtual int dl_rach_info(uint32_t enb_cc_idx, dl_sched_rar_info_t rar_info) = 0;
|
||
|
virtual int dl_ri_info(uint32_t tti, uint16_t rnti, uint32_t enb_cc_idx, uint32_t ri_value) = 0;
|
||
|
virtual int dl_pmi_info(uint32_t tti, uint16_t rnti, uint32_t enb_cc_idx, uint32_t pmi_value) = 0;
|
||
|
virtual int dl_cqi_info(uint32_t tti, uint16_t rnti, uint32_t enb_cc_idx, uint32_t cqi_value) = 0;
|
||
|
virtual int dl_sb_cqi_info(uint32_t tti, uint16_t rnti, uint32_t enb_cc_idx, uint32_t sb_idx, uint32_t cqi) = 0;
|
||
5 years ago
|
|
||
8 years ago
|
/* UL information */
|
||
4 years ago
|
virtual int ul_crc_info(uint32_t tti, uint16_t rnti, uint32_t enb_cc_idx, bool crc) = 0;
|
||
|
virtual int ul_sr_info(uint32_t tti, uint16_t rnti) = 0;
|
||
|
virtual int ul_bsr(uint16_t rnti, uint32_t lcg_id, uint32_t bsr) = 0;
|
||
3 years ago
|
virtual int ul_phr(uint16_t rnti, int phr, uint32_t ul_nof_prb) = 0;
|
||
4 years ago
|
virtual int ul_snr_info(uint32_t tti, uint16_t rnti, uint32_t enb_cc_idx, float snr, uint32_t ul_ch_code) = 0;
|
||
5 years ago
|
|
||
8 years ago
|
/* Run Scheduler for this tti */
|
||
5 years ago
|
virtual int dl_sched(uint32_t tti, uint32_t enb_cc_idx, dl_sched_res_t& sched_result) = 0;
|
||
|
virtual int ul_sched(uint32_t tti, uint32_t enb_cc_idx, ul_sched_res_t& sched_result) = 0;
|
||
5 years ago
|
|
||
|
/* Custom */
|
||
3 years ago
|
virtual void set_dl_tti_mask(uint8_t* tti_mask, uint32_t nof_sfs) = 0;
|
||
|
virtual std::array<int, SRSRAN_MAX_CARRIERS> get_enb_ue_cc_map(uint16_t rnti) = 0;
|
||
|
virtual std::array<int, SRSRAN_MAX_CARRIERS> get_enb_ue_activ_cc_map(uint16_t rnti) = 0;
|
||
|
virtual int ul_buffer_add(uint16_t rnti, uint32_t lcid, uint32_t bytes) = 0;
|
||
8 years ago
|
};
|
||
|
|
||
5 years ago
|
} // namespace srsenb
|
||
8 years ago
|
|
||
4 years ago
|
#endif // SRSRAN_SCHED_INTERFACE_H
|