2021-03-03 08:26:06 -08:00
|
|
|
/**
|
|
|
|
*
|
2021-03-19 03:45:56 -07:00
|
|
|
* \section COPYRIGHT
|
2021-03-03 08:26:06 -08:00
|
|
|
*
|
2021-03-19 03:45:56 -07:00
|
|
|
* Copyright 2013-2021 Software Radio Systems Limited
|
2021-03-03 08:26:06 -08:00
|
|
|
*
|
2021-03-19 03:45:56 -07:00
|
|
|
* 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
|
2021-03-03 08:26:06 -08:00
|
|
|
* the distribution.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2021-03-19 03:45:56 -07:00
|
|
|
#ifndef SRSRAN_SCHED_DCI_H
|
|
|
|
#define SRSRAN_SCHED_DCI_H
|
2021-03-03 08:26:06 -08:00
|
|
|
|
2021-03-14 16:39:52 -07:00
|
|
|
#include "../sched_common.h"
|
2021-05-17 02:48:18 -07:00
|
|
|
#include "srsenb/hdr/stack/mac/sched_phy_ch/sched_phy_resource.h"
|
2021-03-19 03:45:56 -07:00
|
|
|
#include "srsran/adt/bounded_vector.h"
|
2021-03-03 08:26:06 -08:00
|
|
|
|
|
|
|
namespace srsenb {
|
|
|
|
|
|
|
|
struct tbs_info {
|
|
|
|
int tbs_bytes = -1;
|
|
|
|
int mcs = 0;
|
2021-03-04 04:45:16 -08:00
|
|
|
tbs_info() = default;
|
|
|
|
tbs_info(int tbs_bytes_, int mcs_) : tbs_bytes(tbs_bytes_), mcs(mcs_) {}
|
2021-03-03 08:26:06 -08:00
|
|
|
};
|
2021-03-04 04:45:16 -08:00
|
|
|
inline bool operator==(const tbs_info& lhs, const tbs_info& rhs)
|
|
|
|
{
|
|
|
|
return lhs.mcs == rhs.mcs and lhs.tbs_bytes == rhs.tbs_bytes;
|
|
|
|
}
|
|
|
|
inline bool operator!=(const tbs_info& lhs, const tbs_info& rhs)
|
|
|
|
{
|
|
|
|
return not(lhs == rhs);
|
|
|
|
}
|
2021-03-03 08:26:06 -08:00
|
|
|
|
2021-03-04 03:11:33 -08:00
|
|
|
/**
|
|
|
|
* Compute MCS, TBS based on CQI, N_prb
|
|
|
|
* \remark See TS 36.213 - Table 7.1.7.1-1/1A
|
|
|
|
* @return resulting TBS (in bytes) and mcs. TBS=-1 if no valid solution was found.
|
|
|
|
*/
|
2021-03-03 08:26:06 -08:00
|
|
|
tbs_info compute_mcs_and_tbs(uint32_t nof_prb,
|
|
|
|
uint32_t nof_re,
|
|
|
|
uint32_t cqi,
|
|
|
|
uint32_t max_mcs,
|
|
|
|
bool is_ul,
|
|
|
|
bool ulqam64_enabled,
|
|
|
|
bool use_tbs_index_alt);
|
|
|
|
|
2021-03-04 03:11:33 -08:00
|
|
|
/**
|
2021-03-13 05:34:15 -08:00
|
|
|
* Compute lowest MCS, TBS based on CQI, N_prb that satisfies TBS >= req_bytes (best effort)
|
2021-03-04 03:11:33 -08:00
|
|
|
* \remark See TS 36.213 - Table 7.1.7.1-1/1A
|
|
|
|
* @return resulting TBS (in bytes) and mcs. TBS=-1 if no valid solution was found.
|
|
|
|
*/
|
|
|
|
tbs_info compute_min_mcs_and_tbs_from_required_bytes(uint32_t nof_prb,
|
|
|
|
uint32_t nof_re,
|
|
|
|
uint32_t cqi,
|
|
|
|
uint32_t max_mcs,
|
|
|
|
uint32_t req_bytes,
|
|
|
|
bool is_ul,
|
|
|
|
bool ulqam64_enabled,
|
|
|
|
bool use_tbs_index_alt);
|
|
|
|
|
2021-03-14 16:39:52 -07:00
|
|
|
struct pending_rar_t {
|
|
|
|
uint16_t ra_rnti = 0;
|
|
|
|
tti_point prach_tti{};
|
2021-03-19 03:45:56 -07:00
|
|
|
srsran::bounded_vector<sched_interface::dl_sched_rar_info_t, sched_interface::MAX_RAR_LIST> msg3_grant = {};
|
2021-03-14 16:39:52 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
bool generate_sib_dci(sched_interface::dl_sched_bc_t& bc,
|
|
|
|
tti_point tti_tx_dl,
|
|
|
|
uint32_t sib_idx,
|
|
|
|
uint32_t sib_ntx,
|
|
|
|
rbg_interval rbg_range,
|
|
|
|
const sched_cell_params_t& cell_params,
|
|
|
|
uint32_t current_cfi);
|
|
|
|
|
|
|
|
bool generate_paging_dci(sched_interface::dl_sched_bc_t& bc,
|
|
|
|
tti_point tti_tx_dl,
|
|
|
|
uint32_t req_bytes,
|
|
|
|
rbg_interval rbg_range,
|
|
|
|
const sched_cell_params_t& cell_params,
|
|
|
|
uint32_t current_cfi);
|
|
|
|
|
|
|
|
bool generate_rar_dci(sched_interface::dl_sched_rar_t& rar,
|
|
|
|
tti_point tti_tx_dl,
|
|
|
|
const pending_rar_t& pending_rar,
|
|
|
|
rbg_interval rbg_range,
|
|
|
|
uint32_t nof_grants,
|
|
|
|
uint32_t start_msg3_prb,
|
|
|
|
const sched_cell_params_t& cell_params,
|
|
|
|
uint32_t current_cfi);
|
|
|
|
|
|
|
|
void log_broadcast_allocation(const sched_interface::dl_sched_bc_t& bc,
|
|
|
|
rbg_interval rbg_range,
|
|
|
|
const sched_cell_params_t& cell_params);
|
|
|
|
|
|
|
|
void log_rar_allocation(const sched_interface::dl_sched_rar_t& rar,
|
|
|
|
rbg_interval rbg_range,
|
|
|
|
const sched_cell_params_t& cell_params);
|
|
|
|
|
|
|
|
void log_rar_allocation(const sched_interface::dl_sched_rar_t& rar, rbg_interval rbg_range);
|
|
|
|
|
2021-03-03 08:26:06 -08:00
|
|
|
} // namespace srsenb
|
|
|
|
|
2021-03-19 03:45:56 -07:00
|
|
|
#endif // SRSRAN_SCHED_DCI_H
|