|
|
|
@ -23,13 +23,13 @@ void phy_ue_db::init(stack_interface_phy_lte* stack_ptr,
|
|
|
|
|
cell_cfg_list = &cell_cfg_list_;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inline void phy_ue_db::_add_rnti(uint16_t rnti)
|
|
|
|
|
inline int phy_ue_db::_add_rnti(uint16_t rnti)
|
|
|
|
|
{
|
|
|
|
|
// Private function not mutexed
|
|
|
|
|
|
|
|
|
|
// Assert RNTI does NOT exist
|
|
|
|
|
if (ue_db.count(rnti)) {
|
|
|
|
|
return;
|
|
|
|
|
return SRSLTE_ERROR;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Create new UE by accesing it
|
|
|
|
@ -51,6 +51,8 @@ inline void phy_ue_db::_add_rnti(uint16_t rnti)
|
|
|
|
|
for (uint32_t tti = 0; tti < TTIMOD_SZ; tti++) {
|
|
|
|
|
_clear_tti_pending_rnti(tti, rnti);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return SRSLTE_SUCCESS;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inline void phy_ue_db::_clear_tti_pending_rnti(uint32_t tti, uint16_t rnti)
|
|
|
|
@ -234,13 +236,13 @@ inline srsran::phy_cfg_t phy_ue_db::_get_rnti_config(uint16_t rnti, uint32_t enb
|
|
|
|
|
// Make sure the C-RNTI exists and the cell/carrier is configured
|
|
|
|
|
if (_assert_enb_cc(rnti, enb_cc_idx) != SRSRAN_SUCCESS) {
|
|
|
|
|
ERROR("Trying to access cell/carrier %d in RNTI 0x%X. It is not active.", enb_cc_idx, rnti);
|
|
|
|
|
return default_cfg;
|
|
|
|
|
return SRSLTE_ERROR;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Write the current configuration
|
|
|
|
|
uint32_t ue_cc_idx = _get_ue_cc_idx(rnti, enb_cc_idx);
|
|
|
|
|
|
|
|
|
|
// Otherwise return current configuration
|
|
|
|
|
return ue_db.at(rnti).cell_info.at(ue_cc_idx).phy_cfg;
|
|
|
|
|
phy_cfg = ue_db.at(rnti).cell_info.at(ue_cc_idx).phy_cfg;
|
|
|
|
|
return SRSLTE_SUCCESS;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void phy_ue_db::clear_tti_pending_ack(uint32_t tti)
|
|
|
|
@ -329,13 +331,17 @@ void phy_ue_db::addmod_rnti(uint16_t rnti, const phy_interface_rrc_lte::phy_rrc_
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void phy_ue_db::rem_rnti(uint16_t rnti)
|
|
|
|
|
int phy_ue_db::rem_rnti(uint16_t rnti)
|
|
|
|
|
{
|
|
|
|
|
std::lock_guard<std::mutex> lock(mutex);
|
|
|
|
|
|
|
|
|
|
if (ue_db.count(rnti) != 0) {
|
|
|
|
|
ue_db.erase(rnti);
|
|
|
|
|
if (ue_db.count(rnti) == 0) {
|
|
|
|
|
return SRSLTE_ERROR;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ue_db.erase(rnti);
|
|
|
|
|
|
|
|
|
|
return SRSLTE_SUCCESS;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
uint32_t phy_ue_db::_count_nof_configured_scell(uint16_t rnti)
|
|
|
|
@ -350,7 +356,7 @@ uint32_t phy_ue_db::_count_nof_configured_scell(uint16_t rnti)
|
|
|
|
|
return nof_configured_scell;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void phy_ue_db::complete_config(uint16_t rnti)
|
|
|
|
|
int phy_ue_db::complete_config(uint16_t rnti)
|
|
|
|
|
{
|
|
|
|
|
std::lock_guard<std::mutex> lock(mutex);
|
|
|
|
|
|
|
|
|
@ -368,9 +374,11 @@ void phy_ue_db::complete_config(uint16_t rnti)
|
|
|
|
|
ue_db[rnti].cell_info[ue_cc_idx].stash_use_tbs_index_alt =
|
|
|
|
|
ue_db[rnti].cell_info[ue_cc_idx].phy_cfg.dl_cfg.pdsch.use_tbs_index_alt;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return SRSLTE_SUCCESS;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void phy_ue_db::activate_deactivate_scell(uint16_t rnti, uint32_t ue_cc_idx, bool activate)
|
|
|
|
|
int phy_ue_db::activate_deactivate_scell(uint16_t rnti, uint32_t ue_cc_idx, bool activate)
|
|
|
|
|
{
|
|
|
|
|
std::lock_guard<std::mutex> lock(mutex);
|
|
|
|
|
|
|
|
|
@ -383,12 +391,11 @@ void phy_ue_db::activate_deactivate_scell(uint16_t rnti, uint32_t ue_cc_idx, boo
|
|
|
|
|
|
|
|
|
|
// If scell is default only complain
|
|
|
|
|
if (activate and cell_info.state == cell_state_none) {
|
|
|
|
|
ERROR("RNTI 0x%X SCell %d has received an activation MAC command but it was not configured", rnti, ue_cc_idx);
|
|
|
|
|
return;
|
|
|
|
|
return SRSLTE_ERROR;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Set scell state
|
|
|
|
|
cell_info.state = (activate) ? cell_state_secondary_active : cell_state_secondary_inactive;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool phy_ue_db::ue_has_cell(uint16_t rnti, uint32_t enb_cc_idx) const
|
|
|
|
|
{
|
|
|
|
@ -411,10 +418,10 @@ srsran_dl_cfg_t phy_ue_db::get_dl_config(uint16_t rnti, uint32_t enb_cc_idx) con
|
|
|
|
|
if (ue_db.count(rnti) && SRSRAN_RNTI_ISUSER(rnti)) {
|
|
|
|
|
uint32_t ue_cc_idx = _get_ue_cc_idx(rnti, enb_cc_idx);
|
|
|
|
|
if (ue_cc_idx == 0) {
|
|
|
|
|
ret.pdsch.use_tbs_index_alt = ue_db.at(rnti).cell_info[ue_cc_idx].stash_use_tbs_index_alt;
|
|
|
|
|
dl_cfg.pdsch.use_tbs_index_alt = ue_db.at(rnti).cell_info[ue_cc_idx].stash_use_tbs_index_alt;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return ret;
|
|
|
|
|
return SRSLTE_SUCCESS;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
srsran_dci_cfg_t phy_ue_db::get_dci_dl_config(uint16_t rnti, uint32_t enb_cc_idx) const
|
|
|
|
@ -427,22 +434,36 @@ srsran_dci_cfg_t phy_ue_db::get_dci_dl_config(uint16_t rnti, uint32_t enb_cc_idx
|
|
|
|
|
if (ue_db.count(rnti) && SRSRAN_RNTI_ISUSER(rnti)) {
|
|
|
|
|
uint32_t ue_cc_idx = _get_ue_cc_idx(rnti, enb_cc_idx);
|
|
|
|
|
if (ue_cc_idx == 0) {
|
|
|
|
|
ret.multiple_csi_request_enabled = ue_db.at(rnti).stashed_multiple_csi_request_enabled;
|
|
|
|
|
dci_cfg.multiple_csi_request_enabled = ue_db.at(rnti).stashed_multiple_csi_request_enabled;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return ret;
|
|
|
|
|
return SRSLTE_SUCCESS;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
srsran_ul_cfg_t phy_ue_db::get_ul_config(uint16_t rnti, uint32_t enb_cc_idx) const
|
|
|
|
|
{
|
|
|
|
|
std::lock_guard<std::mutex> lock(mutex);
|
|
|
|
|
return _get_rnti_config(rnti, enb_cc_idx).ul_cfg;
|
|
|
|
|
srslte::phy_cfg_t phy_cfg = {};
|
|
|
|
|
|
|
|
|
|
if (_get_rnti_config(rnti, enb_cc_idx, phy_cfg) < SRSLTE_SUCCESS) {
|
|
|
|
|
return SRSLTE_ERROR;
|
|
|
|
|
}
|
|
|
|
|
ul_cfg = phy_cfg.ul_cfg;
|
|
|
|
|
|
|
|
|
|
return SRSLTE_SUCCESS;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
srsran_dci_cfg_t phy_ue_db::get_dci_ul_config(uint16_t rnti, uint32_t enb_cc_idx) const
|
|
|
|
|
{
|
|
|
|
|
std::lock_guard<std::mutex> lock(mutex);
|
|
|
|
|
return _get_rnti_config(rnti, enb_cc_idx).dl_cfg.dci;
|
|
|
|
|
srslte::phy_cfg_t phy_cfg = {};
|
|
|
|
|
|
|
|
|
|
if (_get_rnti_config(rnti, enb_cc_idx, phy_cfg) < SRSLTE_SUCCESS) {
|
|
|
|
|
return SRSLTE_ERROR;
|
|
|
|
|
}
|
|
|
|
|
dci_cfg = phy_cfg.dl_cfg.dci;
|
|
|
|
|
|
|
|
|
|
return SRSLTE_SUCCESS;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool phy_ue_db::set_ack_pending(uint32_t tti, uint32_t enb_cc_idx, const srsran_dci_dl_t& dci)
|
|
|
|
@ -509,17 +530,17 @@ int phy_ue_db::fill_uci_cfg(uint32_t tti,
|
|
|
|
|
|
|
|
|
|
// There is a PUSCH grant available for the provided RNTI in at least one serving cell and this call is for PUCCH
|
|
|
|
|
if (pusch_grant_available and not is_pusch_available) {
|
|
|
|
|
return 0;
|
|
|
|
|
return SRSLTE_SUCCESS;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// There is a PUSCH grant and enb_cc_idx with lowest ue_cc_idx with a grant
|
|
|
|
|
if (pusch_grant_available and uci_enb_cc_id != enb_cc_idx) {
|
|
|
|
|
return 0;
|
|
|
|
|
return SRSLTE_SUCCESS;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// No PUSCH grant for this TTI and cell and no enb_cc_idx is not the PCell
|
|
|
|
|
if (not pusch_grant_available and _get_ue_cc_idx(rnti, enb_cc_idx) != 0) {
|
|
|
|
|
return 0;
|
|
|
|
|
return SRSLTE_SUCCESS;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
common_ue& ue = ue_db.at(rnti);
|
|
|
|
@ -570,7 +591,7 @@ int phy_ue_db::fill_uci_cfg(uint32_t tti,
|
|
|
|
|
uci_required |= (srsran_uci_cfg_total_ack(&uci_cfg) > 0);
|
|
|
|
|
|
|
|
|
|
// Return whether UCI needs to be decoded
|
|
|
|
|
return uci_required ? 1 : 0;
|
|
|
|
|
return uci_required ? 1 : SRSLTE_SUCCESS;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void phy_ue_db::send_uci_data(uint32_t tti,
|
|
|
|
@ -671,6 +692,8 @@ void phy_ue_db::send_uci_data(uint32_t tti,
|
|
|
|
|
stack->ri_info(tti, rnti, cqi_cc_idx, uci_value.ri);
|
|
|
|
|
cqi_scell_info.last_ri = uci_value.ri;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return SRSLTE_SUCCESS;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void phy_ue_db::set_last_ul_tb(uint16_t rnti, uint32_t enb_cc_idx, uint32_t pid, srsran_ra_tb_t tb)
|
|
|
|
@ -684,6 +707,8 @@ void phy_ue_db::set_last_ul_tb(uint16_t rnti, uint32_t enb_cc_idx, uint32_t pid,
|
|
|
|
|
|
|
|
|
|
// Save resource allocation
|
|
|
|
|
ue_db.at(rnti).cell_info[_get_ue_cc_idx(rnti, enb_cc_idx)].last_tb[pid] = tb;
|
|
|
|
|
|
|
|
|
|
return SRSLTE_SUCCESS;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
srsran_ra_tb_t phy_ue_db::get_last_ul_tb(uint16_t rnti, uint32_t enb_cc_idx, uint32_t pid) const
|
|
|
|
@ -695,11 +720,13 @@ srsran_ra_tb_t phy_ue_db::get_last_ul_tb(uint16_t rnti, uint32_t enb_cc_idx, uin
|
|
|
|
|
return {};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Returns the latest stored UL transmission grant
|
|
|
|
|
return ue_db.at(rnti).cell_info[_get_ue_cc_idx(rnti, enb_cc_idx)].last_tb[pid];
|
|
|
|
|
// writes the latest stored UL transmission grant
|
|
|
|
|
ra_tb = ue_db.at(rnti).cell_info[_get_ue_cc_idx(rnti, enb_cc_idx)].last_tb[pid];
|
|
|
|
|
|
|
|
|
|
return SRSLTE_SUCCESS;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void phy_ue_db::set_ul_grant_available(uint32_t tti, const stack_interface_phy_lte::ul_sched_list_t& ul_sched_list)
|
|
|
|
|
int phy_ue_db::set_ul_grant_available(uint32_t tti, const stack_interface_phy_lte::ul_sched_list_t& ul_sched_list)
|
|
|
|
|
{
|
|
|
|
|
std::lock_guard<std::mutex> lock(mutex);
|
|
|
|
|
|
|
|
|
@ -721,6 +748,10 @@ void phy_ue_db::set_ul_grant_available(uint32_t tti, const stack_interface_phy_l
|
|
|
|
|
// Rise Grant available flag
|
|
|
|
|
ue_db[rnti].cell_info[_get_ue_cc_idx(rnti, enb_cc_idx)].is_grant_available[tti] = true;
|
|
|
|
|
}
|
|
|
|
|
// Rise Grant available flag
|
|
|
|
|
ue_db[rnti].cell_info[_get_ue_cc_idx(rnti, enb_cc_idx)].is_grant_available[tti] = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return SRSLTE_SUCCESS;
|
|
|
|
|
}
|
|
|
|
|