Deallocate all CQI resources when deallocating users (#1097)

master
Ismael Gomez 5 years ago committed by GitHub
parent 602690246e
commit 5846e64a4d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -322,8 +322,6 @@ private:
uint32_t sr_N_pucch = 0; uint32_t sr_N_pucch = 0;
uint32_t sr_I = 0; uint32_t sr_I = 0;
bool cqi_allocated = false; bool cqi_allocated = false;
int cqi_sched_sf_idx = 0;
int cqi_sched_prb_idx = 0;
bool nas_pending = false; bool nas_pending = false;
srslte::byte_buffer_t erab_info; srslte::byte_buffer_t erab_info;
@ -332,6 +330,8 @@ private:
typedef struct { typedef struct {
uint32_t idx; uint32_t idx;
uint32_t pucch_res; uint32_t pucch_res;
uint32_t prb_idx;
uint32_t sf_idx;
} cqi_res_t; } cqi_res_t;
std::map<uint32_t, cqi_res_t> cqi_res = {}; std::map<uint32_t, cqi_res_t> cqi_res = {};

@ -2513,14 +2513,20 @@ int rrc::ue::sr_allocate(uint32_t period, uint8_t* I_sr, uint16_t* N_pucch_sr)
int rrc::ue::cqi_free() int rrc::ue::cqi_free()
{ {
if (cqi_allocated) { if (cqi_allocated) {
if (parent->cqi_sched.nof_users[cqi_sched_prb_idx][cqi_sched_sf_idx] > 0) { for (uint32_t cc_idx = 0; cc_idx < get_ue_cc_cfg(UE_PCELL_CC_IDX)->cell_cfg.scell_list.size(); cc_idx++) {
parent->cqi_sched.nof_users[cqi_sched_prb_idx][cqi_sched_sf_idx]--; if (cqi_res.count(cc_idx) > 0) {
if (parent->cqi_sched.nof_users[cqi_res[cc_idx].prb_idx][cqi_res[cc_idx].sf_idx] > 0) {
parent->cqi_sched.nof_users[cqi_res[cc_idx].prb_idx][cqi_res[cc_idx].sf_idx]--;
} else { } else {
parent->rrc_log->warning( parent->rrc_log->warning("Removing CQI resources: no users in time-frequency slot (%d, %d)\n",
"Removing CQI resources: no users in time-frequency slot (%d, %d)\n", cqi_sched_prb_idx, cqi_sched_sf_idx); cqi_res[cc_idx].prb_idx,
cqi_res[cc_idx].sf_idx);
}
parent->rrc_log->info("Deallocated CQI resources for time-frequency slot (%d, %d)\n",
cqi_res[cc_idx].prb_idx,
cqi_res[cc_idx].sf_idx);
}
} }
parent->rrc_log->info(
"Deallocated CQI resources for time-frequency slot (%d, %d)\n", cqi_sched_prb_idx, cqi_sched_sf_idx);
} }
return 0; return 0;
} }
@ -2598,17 +2604,17 @@ int rrc::ue::cqi_allocate(uint32_t period, uint16_t* pmi_idx, uint16_t* n_pucch)
} }
// Allocate user // Allocate user
parent->cqi_sched.nof_users[i_min][j_min]++; parent->cqi_sched.nof_users[i_min][j_min]++;
cqi_sched_prb_idx = i_min;
cqi_sched_sf_idx = j_min;
cqi_allocated = true; cqi_allocated = true;
cqi_res[cc_idx].idx = *pmi_idx; cqi_res[cc_idx].idx = *pmi_idx;
cqi_res[cc_idx].pucch_res = *n_pucch; cqi_res[cc_idx].pucch_res = *n_pucch;
cqi_res[cc_idx].prb_idx = i_min;
cqi_res[cc_idx].sf_idx = j_min;
parent->rrc_log->info( parent->rrc_log->info(
"Allocated CQI resources for cc_idx=%d, time-frequency slot (%d, %d), n_pucch_2=%d, pmi_cfg_idx=%d\n", "Allocated CQI resources for cc_idx=%d, time-frequency slot (%d, %d), n_pucch_2=%d, pmi_cfg_idx=%d\n",
cc_idx, cc_idx,
cqi_sched_prb_idx, i_min,
cqi_sched_sf_idx, j_min,
*n_pucch, *n_pucch,
*pmi_idx); *pmi_idx);
} }

Loading…
Cancel
Save