Commit d5419a27 authored by Robert Schmidt's avatar Robert Schmidt

Correct check for free symbols for PUSCH/PDSCH allocation

parent 9fcc9431
...@@ -571,8 +571,8 @@ bool allocate_dl_retransmission(module_id_t module_id, ...@@ -571,8 +571,8 @@ bool allocate_dl_retransmission(module_id_t module_id,
rbStart += rbSize; /* last iteration rbSize was not enough, skip it */ rbStart += rbSize; /* last iteration rbSize was not enough, skip it */
rbSize = 0; rbSize = 0;
while (rbStart < bwpSize && const int slbitmap = SL_to_bitmap(ps->startSymbolIndex, ps->nrOfSymbols);
!(rballoc_mask[rbStart]&SL_to_bitmap(ps->startSymbolIndex, ps->nrOfSymbols))) while (rbStart < bwpSize && (rballoc_mask[rbStart] & slbitmap) != slbitmap)
rbStart++; rbStart++;
if (rbStart >= bwpSize) { if (rbStart >= bwpSize) {
...@@ -581,7 +581,7 @@ bool allocate_dl_retransmission(module_id_t module_id, ...@@ -581,7 +581,7 @@ bool allocate_dl_retransmission(module_id_t module_id,
} }
while (rbStart + rbSize < bwpSize && while (rbStart + rbSize < bwpSize &&
(rballoc_mask[rbStart + rbSize]&SL_to_bitmap(ps->startSymbolIndex, ps->nrOfSymbols)) && (rballoc_mask[rbStart + rbSize] & slbitmap) == slbitmap &&
rbSize < retInfo->rbSize) rbSize < retInfo->rbSize)
rbSize++; rbSize++;
} }
...@@ -614,12 +614,11 @@ bool allocate_dl_retransmission(module_id_t module_id, ...@@ -614,12 +614,11 @@ bool allocate_dl_retransmission(module_id_t module_id,
ps->nrOfLayers, ps->nrOfLayers,
sched_ctrl, sched_ctrl,
&temp_ps); &temp_ps);
while (rbStart < bwpSize && const uint16_t slbitmap = SL_to_bitmap(temp_ps.startSymbolIndex, temp_ps.nrOfSymbols);
!(rballoc_mask[rbStart]&SL_to_bitmap(temp_ps.startSymbolIndex, temp_ps.nrOfSymbols))) while (rbStart < bwpSize && (rballoc_mask[rbStart] & slbitmap) != slbitmap)
rbStart++; rbStart++;
while (rbStart + rbSize < bwpSize && while (rbStart + rbSize < bwpSize && (rballoc_mask[rbStart + rbSize] & slbitmap) == slbitmap)
(rballoc_mask[rbStart + rbSize]&SL_to_bitmap(temp_ps.startSymbolIndex, temp_ps.nrOfSymbols)))
rbSize++; rbSize++;
uint32_t new_tbs; uint32_t new_tbs;
...@@ -929,14 +928,12 @@ void pf_dl(module_id_t module_id, ...@@ -929,14 +928,12 @@ void pf_dl(module_id_t module_id,
const uint16_t slbitmap = SL_to_bitmap(ps->startSymbolIndex, ps->nrOfSymbols); const uint16_t slbitmap = SL_to_bitmap(ps->startSymbolIndex, ps->nrOfSymbols);
// Freq-demain allocation // Freq-demain allocation
while (rbStart < bwpSize && while (rbStart < bwpSize && (rballoc_mask[rbStart] & slbitmap) != slbitmap)
!(rballoc_mask[rbStart]&slbitmap))
rbStart++; rbStart++;
uint16_t max_rbSize = 1; uint16_t max_rbSize = 1;
while (rbStart + max_rbSize < bwpSize && while (rbStart + max_rbSize < bwpSize && (rballoc_mask[rbStart + max_rbSize] & slbitmap) == slbitmap)
(rballoc_mask[rbStart + max_rbSize]&slbitmap))
max_rbSize++; max_rbSize++;
sched_pdsch->Qm = nr_get_Qm_dl(sched_pdsch->mcs, ps->mcsTableIdx); sched_pdsch->Qm = nr_get_Qm_dl(sched_pdsch->mcs, ps->mcsTableIdx);
......
...@@ -1002,8 +1002,8 @@ bool allocate_ul_retransmission(module_id_t module_id, ...@@ -1002,8 +1002,8 @@ bool allocate_ul_retransmission(module_id_t module_id,
} }
/* Check the resource is enough for retransmission */ /* Check the resource is enough for retransmission */
while (rbStart < bwpSize && const uint16_t slbitmap = SL_to_bitmap(ps->startSymbolIndex, ps->nrOfSymbols);
!(rballoc_mask[rbStart]&SL_to_bitmap(ps->startSymbolIndex, ps->nrOfSymbols))) while (rbStart < bwpSize && (rballoc_mask[rbStart] & slbitmap) != slbitmap)
rbStart++; rbStart++;
if (rbStart + retInfo->rbSize > bwpSize) { if (rbStart + retInfo->rbSize > bwpSize) {
LOG_W(NR_MAC, "cannot allocate retransmission of UE %d/RNTI %04x: no resources (rbStart %d, retInfo->rbSize %d, bwpSize %d\n", UE_id, UE_info->rnti[UE_id], rbStart, retInfo->rbSize, bwpSize); LOG_W(NR_MAC, "cannot allocate retransmission of UE %d/RNTI %04x: no resources (rbStart %d, retInfo->rbSize %d, bwpSize %d\n", UE_id, UE_info->rnti[UE_id], rbStart, retInfo->rbSize, bwpSize);
...@@ -1023,12 +1023,11 @@ bool allocate_ul_retransmission(module_id_t module_id, ...@@ -1023,12 +1023,11 @@ bool allocate_ul_retransmission(module_id_t module_id,
&temp_ps); &temp_ps);
/* the retransmission will use a different time domain allocation, check /* the retransmission will use a different time domain allocation, check
* that we have enough resources */ * that we have enough resources */
while (rbStart < bwpSize && const uint16_t slbitmap = SL_to_bitmap(temp_ps.startSymbolIndex, temp_ps.nrOfSymbols);
!(rballoc_mask[rbStart]&SL_to_bitmap(temp_ps.startSymbolIndex, temp_ps.nrOfSymbols))) while (rbStart < bwpSize && (rballoc_mask[rbStart] & slbitmap) != slbitmap)
rbStart++; rbStart++;
int rbSize = 0; int rbSize = 0;
while (rbStart + rbSize < bwpSize && while (rbStart + rbSize < bwpSize && (rballoc_mask[rbStart + rbSize] & slbitmap) == slbitmap)
(rballoc_mask[rbStart + rbSize]&SL_to_bitmap(temp_ps.startSymbolIndex, temp_ps.nrOfSymbols)))
rbSize++; rbSize++;
uint32_t new_tbs; uint32_t new_tbs;
uint16_t new_rbSize; uint16_t new_rbSize;
...@@ -1260,8 +1259,8 @@ void pf_ul(module_id_t module_id, ...@@ -1260,8 +1259,8 @@ void pf_ul(module_id_t module_id,
} }
LOG_D(NR_MAC,"Looking for min_rb %d RBs, starting at %d\n", min_rb, rbStart); LOG_D(NR_MAC,"Looking for min_rb %d RBs, starting at %d\n", min_rb, rbStart);
while (rbStart < bwpSize && const uint16_t slbitmap = SL_to_bitmap(ps->startSymbolIndex, ps->nrOfSymbols);
!(rballoc_mask[rbStart]&SL_to_bitmap(ps->startSymbolIndex, ps->nrOfSymbols))) while (rbStart < bwpSize && (rballoc_mask[rbStart] & slbitmap) != slbitmap)
rbStart++; rbStart++;
if (rbStart + min_rb >= bwpSize) { if (rbStart + min_rb >= bwpSize) {
LOG_W(NR_MAC, "cannot allocate continuous UL data for UE %d/RNTI %04x: no resources (rbStart %d, min_rb %d, bwpSize %d\n", LOG_W(NR_MAC, "cannot allocate continuous UL data for UE %d/RNTI %04x: no resources (rbStart %d, min_rb %d, bwpSize %d\n",
...@@ -1294,7 +1293,7 @@ void pf_ul(module_id_t module_id, ...@@ -1294,7 +1293,7 @@ void pf_ul(module_id_t module_id,
/* Mark the corresponding RBs as used */ /* Mark the corresponding RBs as used */
n_rb_sched -= sched_pusch->rbSize; n_rb_sched -= sched_pusch->rbSize;
for (int rb = 0; rb < sched_ctrl->sched_pusch.rbSize; rb++) for (int rb = 0; rb < sched_ctrl->sched_pusch.rbSize; rb++)
rballoc_mask[rb + sched_ctrl->sched_pusch.rbStart] ^= SL_to_bitmap(ps->startSymbolIndex, ps->nrOfSymbols); rballoc_mask[rb + sched_ctrl->sched_pusch.rbStart] ^= slbitmap;
continue; continue;
} }
...@@ -1398,13 +1397,12 @@ void pf_ul(module_id_t module_id, ...@@ -1398,13 +1397,12 @@ void pf_ul(module_id_t module_id,
} }
update_ul_ue_R_Qm(sched_pusch, ps); update_ul_ue_R_Qm(sched_pusch, ps);
while (rbStart < bwpSize && const uint16_t slbitmap = SL_to_bitmap(ps->startSymbolIndex, ps->nrOfSymbols);
!(rballoc_mask[rbStart]&SL_to_bitmap(ps->startSymbolIndex, ps->nrOfSymbols))) while (rbStart < bwpSize && (rballoc_mask[rbStart] & slbitmap) != slbitmap)
rbStart++; rbStart++;
sched_pusch->rbStart = rbStart; sched_pusch->rbStart = rbStart;
uint16_t max_rbSize = 1; uint16_t max_rbSize = 1;
while (rbStart + max_rbSize < bwpSize && while (rbStart + max_rbSize < bwpSize && (rballoc_mask[rbStart + max_rbSize] & slbitmap) == slbitmap)
(rballoc_mask[rbStart + max_rbSize]&&SL_to_bitmap(ps->startSymbolIndex, ps->nrOfSymbols)))
max_rbSize++; max_rbSize++;
if (rbStart + min_rb >= bwpSize) { if (rbStart + min_rb >= bwpSize) {
...@@ -1445,7 +1443,7 @@ void pf_ul(module_id_t module_id, ...@@ -1445,7 +1443,7 @@ void pf_ul(module_id_t module_id,
n_rb_sched -= sched_pusch->rbSize; n_rb_sched -= sched_pusch->rbSize;
for (int rb = 0; rb < sched_ctrl->sched_pusch.rbSize; rb++) for (int rb = 0; rb < sched_ctrl->sched_pusch.rbSize; rb++)
rballoc_mask[rb + sched_ctrl->sched_pusch.rbStart] ^= SL_to_bitmap(ps->startSymbolIndex, ps->nrOfSymbols); rballoc_mask[rb + sched_ctrl->sched_pusch.rbStart] ^= slbitmap;
} }
} }
......
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