Commit 5d488fcb authored by luis_pereira87's avatar luis_pereira87

Merge remote-tracking branch 'origin/multiple-ues-min-prbs-bug-fix' into Dedicated-BWPs

# Conflicts:
#	openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c
#	openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c
parents 06d07e3a 0a632210
...@@ -598,6 +598,7 @@ bool allocate_dl_retransmission(module_id_t module_id, ...@@ -598,6 +598,7 @@ bool allocate_dl_retransmission(module_id_t module_id,
temp_ps.nrOfSymbols, temp_ps.nrOfSymbols,
temp_ps.N_PRB_DMRS * temp_ps.N_DMRS_SLOT, temp_ps.N_PRB_DMRS * temp_ps.N_DMRS_SLOT,
retInfo->tb_size, retInfo->tb_size,
1, /* minimum of 1RB: need to find exact TBS, don't preclude any number */
rbSize, rbSize,
&new_tbs, &new_tbs,
&new_rbSize); &new_rbSize);
...@@ -739,8 +740,9 @@ void pf_dl(module_id_t module_id, ...@@ -739,8 +740,9 @@ void pf_dl(module_id_t module_id,
} }
} }
const int min_rbSize = 5;
/* Loop UE_sched to find max coeff and allocate transmission */ /* Loop UE_sched to find max coeff and allocate transmission */
while (max_num_ue > 0 && n_rb_sched >= MIN_NUM_PRBS_TO_SCHEDULE && UE_sched.head >= 0) { while (max_num_ue > 0 && n_rb_sched >= min_rbSize && UE_sched.head >= 0) {
/* Find max coeff from UE_sched*/ /* Find max coeff from UE_sched*/
int *max = &UE_sched.head; /* assume head is max */ int *max = &UE_sched.head; /* assume head is max */
...@@ -800,9 +802,6 @@ void pf_dl(module_id_t module_id, ...@@ -800,9 +802,6 @@ void pf_dl(module_id_t module_id,
LOG_D(NR_MAC, "%4d.%2d could not find CCE for DL DCI UE %d/RNTI %04x\n", frame, slot, UE_id, rnti); LOG_D(NR_MAC, "%4d.%2d could not find CCE for DL DCI UE %d/RNTI %04x\n", frame, slot, UE_id, rnti);
continue; continue;
} }
/* reduce max_num_ue once we are sure UE can be allocated, i.e., has CCE */
max_num_ue--;
if (max_num_ue < 0) return;
/* Find PUCCH occasion: if it fails, undo CCE allocation (undoing PUCCH /* Find PUCCH occasion: if it fails, undo CCE allocation (undoing PUCCH
* allocation after CCE alloc fail would be more complex) */ * allocation after CCE alloc fail would be more complex) */
...@@ -816,9 +815,14 @@ void pf_dl(module_id_t module_id, ...@@ -816,9 +815,14 @@ void pf_dl(module_id_t module_id,
frame, frame,
slot); slot);
mac->pdcch_cand[cid]--; mac->pdcch_cand[cid]--;
return; continue;
} }
/* reduce max_num_ue once we are sure UE can be allocated, i.e., has CCE
* and PUCCH */
max_num_ue--;
AssertFatal(max_num_ue >= 0, "Illegal max_num_ue %d\n", max_num_ue);
sched_ctrl->cce_index = CCEIndex; sched_ctrl->cce_index = CCEIndex;
fill_pdcch_vrb_map(mac, fill_pdcch_vrb_map(mac,
...@@ -859,6 +863,7 @@ void pf_dl(module_id_t module_id, ...@@ -859,6 +863,7 @@ void pf_dl(module_id_t module_id,
ps->nrOfSymbols, ps->nrOfSymbols,
ps->N_PRB_DMRS * ps->N_DMRS_SLOT, ps->N_PRB_DMRS * ps->N_DMRS_SLOT,
sched_ctrl->num_total_bytes + oh, sched_ctrl->num_total_bytes + oh,
min_rbSize,
max_rbSize, max_rbSize,
&TBS, &TBS,
&rbSize); &rbSize);
......
...@@ -388,6 +388,7 @@ bool nr_find_nb_rb(uint16_t Qm, ...@@ -388,6 +388,7 @@ bool nr_find_nb_rb(uint16_t Qm,
uint16_t nb_symb_sch, uint16_t nb_symb_sch,
uint16_t nb_dmrs_prb, uint16_t nb_dmrs_prb,
uint32_t bytes, uint32_t bytes,
uint16_t nb_rb_min,
uint16_t nb_rb_max, uint16_t nb_rb_max,
uint32_t *tbs, uint32_t *tbs,
uint16_t *nb_rb) uint16_t *nb_rb)
...@@ -403,7 +404,7 @@ bool nr_find_nb_rb(uint16_t Qm, ...@@ -403,7 +404,7 @@ bool nr_find_nb_rb(uint16_t Qm,
return true; return true;
/* is the minimum enough? */ /* is the minimum enough? */
*nb_rb = MIN_NUM_PRBS_TO_SCHEDULE; *nb_rb = nb_rb_min;
*tbs = nr_compute_tbs(Qm, R, *nb_rb, nb_symb_sch, nb_dmrs_prb, 0, 0, 1) >> 3; *tbs = nr_compute_tbs(Qm, R, *nb_rb, nb_symb_sch, nb_dmrs_prb, 0, 0, 1) >> 3;
if (bytes <= *tbs) if (bytes <= *tbs)
return true; return true;
...@@ -411,7 +412,7 @@ bool nr_find_nb_rb(uint16_t Qm, ...@@ -411,7 +412,7 @@ bool nr_find_nb_rb(uint16_t Qm,
/* perform binary search to allocate all bytes within a TBS up to nb_rb_max /* perform binary search to allocate all bytes within a TBS up to nb_rb_max
* RBs */ * RBs */
int hi = nb_rb_max; int hi = nb_rb_max;
int lo = 1; int lo = nb_rb_min;
for (int p = (hi + lo) / 2; lo + 1 < hi; p = (hi + lo) / 2) { for (int p = (hi + lo) / 2; lo + 1 < hi; p = (hi + lo) / 2) {
const uint32_t TBS = nr_compute_tbs(Qm, R, p, nb_symb_sch, nb_dmrs_prb, 0, 0, 1) >> 3; const uint32_t TBS = nr_compute_tbs(Qm, R, p, nb_symb_sch, nb_dmrs_prb, 0, 0, 1) >> 3;
if (bytes == TBS) { if (bytes == TBS) {
......
...@@ -1004,6 +1004,7 @@ bool allocate_ul_retransmission(module_id_t module_id, ...@@ -1004,6 +1004,7 @@ bool allocate_ul_retransmission(module_id_t module_id,
temp_ps.nrOfSymbols, temp_ps.nrOfSymbols,
temp_ps.N_PRB_DMRS * temp_ps.num_dmrs_symb, temp_ps.N_PRB_DMRS * temp_ps.num_dmrs_symb,
retInfo->tb_size, retInfo->tb_size,
1, /* minimum of 1RB: need to find exact TBS, don't preclude any number */
rbSize, rbSize,
&new_tbs, &new_tbs,
&new_rbSize); &new_rbSize);
...@@ -1256,8 +1257,9 @@ void pf_ul(module_id_t module_id, ...@@ -1256,8 +1257,9 @@ void pf_ul(module_id_t module_id,
} }
const int min_rbSize = 5;
/* Loop UE_sched to find max coeff and allocate transmission */ /* Loop UE_sched to find max coeff and allocate transmission */
while (UE_sched.head >= 0 && max_num_ue> 0 && n_rb_sched > 0) { while (UE_sched.head >= 0 && max_num_ue> 0 && n_rb_sched >= min_rbSize) {
/* Find max coeff */ /* Find max coeff */
int *max = &UE_sched.head; /* Find max coeff: assume head is max */ int *max = &UE_sched.head; /* Find max coeff: assume head is max */
int *p = &UE_sched.next[*max]; int *p = &UE_sched.next[*max];
...@@ -1303,8 +1305,7 @@ void pf_ul(module_id_t module_id, ...@@ -1303,8 +1305,7 @@ void pf_ul(module_id_t module_id,
/* reduce max_num_ue once we are sure UE can be allocated, i.e., has CCE */ /* reduce max_num_ue once we are sure UE can be allocated, i.e., has CCE */
max_num_ue--; max_num_ue--;
if (max_num_ue < 0) AssertFatal(max_num_ue >= 0, "Illegal max_num_ue %d\n", max_num_ue);
return;
NR_CellGroupConfig_t *cg = UE_info->CellGroup[UE_id]; NR_CellGroupConfig_t *cg = UE_info->CellGroup[UE_id];
NR_BWP_UplinkDedicated_t *ubwpd= cg ? cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP:NULL; NR_BWP_UplinkDedicated_t *ubwpd= cg ? cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP:NULL;
...@@ -1349,6 +1350,7 @@ void pf_ul(module_id_t module_id, ...@@ -1349,6 +1350,7 @@ void pf_ul(module_id_t module_id,
ps->nrOfSymbols, ps->nrOfSymbols,
ps->N_PRB_DMRS * ps->num_dmrs_symb, ps->N_PRB_DMRS * ps->num_dmrs_symb,
B, B,
min_rbSize,
max_rbSize, max_rbSize,
&TBS, &TBS,
&rbSize); &rbSize);
......
...@@ -463,6 +463,7 @@ bool nr_find_nb_rb(uint16_t Qm, ...@@ -463,6 +463,7 @@ bool nr_find_nb_rb(uint16_t Qm,
uint16_t nb_symb_sch, uint16_t nb_symb_sch,
uint16_t nb_dmrs_prb, uint16_t nb_dmrs_prb,
uint32_t bytes, uint32_t bytes,
uint16_t nb_rb_min,
uint16_t nb_rb_max, uint16_t nb_rb_max,
uint32_t *tbs, uint32_t *tbs,
uint16_t *nb_rb); uint16_t *nb_rb);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment