Commit 3e192e04 authored by ChiehChun's avatar ChiehChun

Calculate rbSize from estimated buffer

parent ed311464
...@@ -564,16 +564,6 @@ void nr_simple_ulsch_preprocessor(module_id_t module_id, ...@@ -564,16 +564,6 @@ void nr_simple_ulsch_preprocessor(module_id_t module_id,
if (!is_xlsch_in_slot(ulsch_in_slot_bitmap, sched_slot)) if (!is_xlsch_in_slot(ulsch_in_slot_bitmap, sched_slot))
return; return;
/* get first, largest unallocated region */
uint16_t *vrb_map_UL =
&RC.nrmac[module_id]->common_channels[CC_id].vrb_map_UL[sched_slot * 275];
uint16_t rbStart = 0;
while (vrb_map_UL[rbStart]) rbStart++;
const uint16_t bwpSize = NRRIV2BW(sched_ctrl->active_ubwp->bwp_Common->genericParameters.locationAndBandwidth,275);
uint16_t rbSize = 1;
while (rbStart + rbSize < bwpSize && !vrb_map_UL[rbStart+rbSize])
rbSize++;
sched_ctrl->sched_pusch.slot = sched_slot; sched_ctrl->sched_pusch.slot = sched_slot;
sched_ctrl->sched_pusch.frame = sched_frame; sched_ctrl->sched_pusch.frame = sched_frame;
...@@ -622,8 +612,6 @@ void nr_simple_ulsch_preprocessor(module_id_t module_id, ...@@ -622,8 +612,6 @@ void nr_simple_ulsch_preprocessor(module_id_t module_id,
const int mcs = 9; const int mcs = 9;
NR_sched_pusch_t *sched_pusch = &sched_ctrl->sched_pusch; NR_sched_pusch_t *sched_pusch = &sched_ctrl->sched_pusch;
sched_pusch->mcs = mcs; sched_pusch->mcs = mcs;
sched_pusch->rbStart = rbStart;
sched_pusch->rbSize = rbSize;
/* Calculate TBS from MCS */ /* Calculate TBS from MCS */
sched_pusch->R = nr_get_code_rate_ul(mcs, ps->mcs_table); sched_pusch->R = nr_get_code_rate_ul(mcs, ps->mcs_table);
...@@ -633,6 +621,22 @@ void nr_simple_ulsch_preprocessor(module_id_t module_id, ...@@ -633,6 +621,22 @@ void nr_simple_ulsch_preprocessor(module_id_t module_id,
sched_pusch->R >>= 1; sched_pusch->R >>= 1;
sched_pusch->Qm <<= 1; sched_pusch->Qm <<= 1;
} }
/* get first, largest unallocated region */
uint16_t *vrb_map_UL =
&RC.nrmac[module_id]->common_channels[CC_id].vrb_map_UL[sched_slot * 275];
int rbStart = NRRIV2PRBOFFSET(sched_ctrl->active_bwp->bwp_Common->genericParameters.locationAndBandwidth, 275);
const uint16_t bwpSize = NRRIV2BW(sched_ctrl->active_ubwp->bwp_Common->genericParameters.locationAndBandwidth,275);
while (rbStart < bwpSize && vrb_map_UL[rbStart]) rbStart++;
uint16_t rbSize = 4;
sched_pusch->rbStart = rbStart;
const int B = cmax(sched_ctrl->estimated_ul_buffer - sched_ctrl->sched_ul_bytes, 0);
do {
rbSize++;
sched_pusch->rbSize = rbSize;
sched_pusch->tb_size = nr_compute_tbs(sched_pusch->Qm, sched_pusch->tb_size = nr_compute_tbs(sched_pusch->Qm,
sched_pusch->R, sched_pusch->R,
sched_pusch->rbSize, sched_pusch->rbSize,
...@@ -642,6 +646,10 @@ void nr_simple_ulsch_preprocessor(module_id_t module_id, ...@@ -642,6 +646,10 @@ void nr_simple_ulsch_preprocessor(module_id_t module_id,
0, 0,
1 /* NrOfLayers */) 1 /* NrOfLayers */)
>> 3; >> 3;
} while (rbStart + rbSize < bwpSize && !vrb_map_UL[rbStart+rbSize] &&
sched_pusch->tb_size < B);
LOG_D(MAC,"rbSize %d, TBS %d, est buf %d, sched_ul %d, B %d\n",
rbSize, sched_pusch->tb_size, sched_ctrl->estimated_ul_buffer, sched_ctrl->sched_ul_bytes, B);
/* mark the corresponding RBs as used */ /* mark the corresponding RBs as used */
for (int rb = 0; rb < sched_ctrl->sched_pusch.rbSize; rb++) for (int rb = 0; rb < sched_ctrl->sched_pusch.rbSize; 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