Commit 39defb49 authored by francescomani's avatar francescomani

passing nroflayers to nr_find_nb_rb

parent 311b9768
...@@ -491,6 +491,7 @@ bool allocate_dl_retransmission(module_id_t module_id, ...@@ -491,6 +491,7 @@ bool allocate_dl_retransmission(module_id_t module_id,
uint16_t new_rbSize; uint16_t new_rbSize;
bool success = nr_find_nb_rb(retInfo->Qm, bool success = nr_find_nb_rb(retInfo->Qm,
retInfo->R, retInfo->R,
retInfo->nrOfLayers,
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,
...@@ -704,6 +705,7 @@ void pf_dl(module_id_t module_id, ...@@ -704,6 +705,7 @@ void pf_dl(module_id_t module_id,
+ 2 * (frame == (sched_ctrl->ta_frame + 10) % 1024); + 2 * (frame == (sched_ctrl->ta_frame + 10) % 1024);
nr_find_nb_rb(sched_pdsch->Qm, nr_find_nb_rb(sched_pdsch->Qm,
sched_pdsch->R, sched_pdsch->R,
sched_pdsch->nrOfLayers,
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,
......
...@@ -284,6 +284,7 @@ int allocate_nr_CCEs(gNB_MAC_INST *nr_mac, ...@@ -284,6 +284,7 @@ int allocate_nr_CCEs(gNB_MAC_INST *nr_mac,
bool nr_find_nb_rb(uint16_t Qm, bool nr_find_nb_rb(uint16_t Qm,
uint16_t R, uint16_t R,
uint8_t nrOfLayers,
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,
...@@ -293,7 +294,7 @@ bool nr_find_nb_rb(uint16_t Qm, ...@@ -293,7 +294,7 @@ bool nr_find_nb_rb(uint16_t Qm,
{ {
/* is the maximum (not even) enough? */ /* is the maximum (not even) enough? */
*nb_rb = nb_rb_max; *nb_rb = nb_rb_max;
*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, nrOfLayers) >> 3;
/* check whether it does not fit, or whether it exactly fits. Some algorithms /* check whether it does not fit, or whether it exactly fits. Some algorithms
* might depend on the return value! */ * might depend on the return value! */
if (bytes > *tbs) if (bytes > *tbs)
...@@ -303,7 +304,7 @@ bool nr_find_nb_rb(uint16_t Qm, ...@@ -303,7 +304,7 @@ bool nr_find_nb_rb(uint16_t Qm,
/* is the minimum enough? */ /* is the minimum enough? */
*nb_rb = 1; *nb_rb = 1;
*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, nrOfLayers) >> 3;
if (bytes <= *tbs) if (bytes <= *tbs)
return true; return true;
...@@ -312,7 +313,7 @@ bool nr_find_nb_rb(uint16_t Qm, ...@@ -312,7 +313,7 @@ bool nr_find_nb_rb(uint16_t Qm,
int hi = nb_rb_max; int hi = nb_rb_max;
int lo = 1; int lo = 1;
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, nrOfLayers) >> 3;
if (bytes == TBS) { if (bytes == TBS) {
hi = p; hi = p;
break; break;
...@@ -323,7 +324,7 @@ bool nr_find_nb_rb(uint16_t Qm, ...@@ -323,7 +324,7 @@ bool nr_find_nb_rb(uint16_t Qm,
} }
} }
*nb_rb = hi; *nb_rb = hi;
*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, nrOfLayers) >> 3;
/* return whether we could allocate all bytes and stay below nb_rb_max */ /* return whether we could allocate all bytes and stay below nb_rb_max */
return *tbs >= bytes && *nb_rb <= nb_rb_max; return *tbs >= bytes && *nb_rb <= nb_rb_max;
} }
......
...@@ -889,6 +889,7 @@ bool allocate_ul_retransmission(module_id_t module_id, ...@@ -889,6 +889,7 @@ bool allocate_ul_retransmission(module_id_t module_id,
uint16_t new_rbSize; uint16_t new_rbSize;
bool success = nr_find_nb_rb(retInfo->Qm, bool success = nr_find_nb_rb(retInfo->Qm,
retInfo->R, retInfo->R,
1, // layers
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,
...@@ -1146,6 +1147,7 @@ void pf_ul(module_id_t module_id, ...@@ -1146,6 +1147,7 @@ void pf_ul(module_id_t module_id,
uint32_t TBS = 0; uint32_t TBS = 0;
nr_find_nb_rb(sched_pusch->Qm, nr_find_nb_rb(sched_pusch->Qm,
sched_pusch->R, sched_pusch->R,
1, // layers
ps->nrOfSymbols, ps->nrOfSymbols,
ps->N_PRB_DMRS * ps->num_dmrs_symb, ps->N_PRB_DMRS * ps->num_dmrs_symb,
B, B,
......
...@@ -426,6 +426,7 @@ bool find_free_CCE(module_id_t module_id, sub_frame_t slot, int UE_id); ...@@ -426,6 +426,7 @@ bool find_free_CCE(module_id_t module_id, sub_frame_t slot, int UE_id);
bool nr_find_nb_rb(uint16_t Qm, bool nr_find_nb_rb(uint16_t Qm,
uint16_t R, uint16_t R,
uint8_t nrOfLayers,
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,
......
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