Commit a3685e6b authored by Robert Schmidt's avatar Robert Schmidt

Merge remote-tracking branch 'origin/multi-ue-fixes' into integration_2023_w08

parents f4412ac0 e9ff5ee5
...@@ -383,7 +383,8 @@ bool allocate_dl_retransmission(module_id_t module_id, ...@@ -383,7 +383,8 @@ bool allocate_dl_retransmission(module_id_t module_id,
uint16_t *rballoc_mask, uint16_t *rballoc_mask,
int *n_rb_sched, int *n_rb_sched,
NR_UE_info_t *UE, NR_UE_info_t *UE,
int current_harq_pid) { int current_harq_pid)
{
int CC_id = 0; int CC_id = 0;
gNB_MAC_INST *nr_mac = RC.nrmac[module_id]; gNB_MAC_INST *nr_mac = RC.nrmac[module_id];
...@@ -408,21 +409,30 @@ bool allocate_dl_retransmission(module_id_t module_id, ...@@ -408,21 +409,30 @@ bool allocate_dl_retransmission(module_id_t module_id,
const int tda = get_dl_tda(nr_mac, scc, slot); const int tda = get_dl_tda(nr_mac, scc, slot);
AssertFatal(tda>=0,"Unable to find PDSCH time domain allocation in list\n"); AssertFatal(tda>=0,"Unable to find PDSCH time domain allocation in list\n");
if (tda == retInfo->time_domain_allocation && /* Check first whether the old TDA can be reused
layers == retInfo->nrOfLayers) { * this helps allocate retransmission when TDA changes (e.g. new nrOfSymbols > old nrOfSymbols) */
NR_tda_info_t temp_tda = nr_get_pdsch_tda_info(dl_bwp, tda);
bool reuse_old_tda = (retInfo->tda_info.startSymbolIndex == temp_tda.startSymbolIndex) && (retInfo->tda_info.nrOfSymbols <= temp_tda.nrOfSymbols);
LOG_D(NR_MAC, "[UE %x] %s old TDA, %s number of layers\n",
UE->rnti,
reuse_old_tda ? "reuse" : "do not reuse",
layers == retInfo->nrOfLayers ? "same" : "different");
NR_tda_info_t *tda_info = &retInfo->tda_info; if (reuse_old_tda && layers == retInfo->nrOfLayers) {
/* Check that there are enough resources for retransmission */ /* Check that there are enough resources for retransmission */
while (rbSize < retInfo->rbSize) { while (rbSize < retInfo->rbSize) {
rbStart += rbSize; /* last iteration rbSize was not enough, skip it */ rbStart += rbSize; /* last iteration rbSize was not enough, skip it */
rbSize = 0; rbSize = 0;
const int slbitmap = SL_to_bitmap(tda_info->startSymbolIndex, tda_info->nrOfSymbols); const uint16_t slbitmap = SL_to_bitmap(retInfo->tda_info.startSymbolIndex, retInfo->tda_info.nrOfSymbols);
while (rbStart < bwpSize && (rballoc_mask[rbStart] & slbitmap) != slbitmap) while (rbStart < bwpSize && (rballoc_mask[rbStart] & slbitmap) != slbitmap)
rbStart++; rbStart++;
if (rbStart >= bwpSize) { if (rbStart >= bwpSize) {
LOG_D(NR_MAC, "cannot allocate retransmission for RNTI %04x: no resources\n", UE->rnti); LOG_D(NR_MAC, "[UE %04x][%4d.%2d] could not allocate DL retransmission: no resources\n",
UE->rnti,
frame,
slot);
return false; return false;
} }
...@@ -434,7 +444,6 @@ bool allocate_dl_retransmission(module_id_t module_id, ...@@ -434,7 +444,6 @@ bool allocate_dl_retransmission(module_id_t module_id,
} else { } else {
/* 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 */
NR_tda_info_t temp_tda = nr_get_pdsch_tda_info(dl_bwp, tda);
NR_pdsch_dmrs_t temp_dmrs = get_dl_dmrs_params(scc, NR_pdsch_dmrs_t temp_dmrs = get_dl_dmrs_params(scc,
dl_bwp, dl_bwp,
&temp_tda, &temp_tda,
...@@ -461,7 +470,12 @@ bool allocate_dl_retransmission(module_id_t module_id, ...@@ -461,7 +470,12 @@ bool allocate_dl_retransmission(module_id_t module_id,
&new_rbSize); &new_rbSize);
if (!success || new_tbs != retInfo->tb_size) { if (!success || new_tbs != retInfo->tb_size) {
LOG_D(MAC, "new TBsize %d of new TDA does not match old TBS %d\n", new_tbs, retInfo->tb_size); LOG_D(NR_MAC, "[UE %04x][%4d.%2d] allocation of DL retransmission failed: new TBS %d of new TDA does not match old TBS %d\n",
UE->rnti,
frame,
slot,
new_tbs,
retInfo->tb_size);
return false; /* the maximum TBsize we might have is smaller than what we need */ return false; /* the maximum TBsize we might have is smaller than what we need */
} }
...@@ -485,8 +499,10 @@ bool allocate_dl_retransmission(module_id_t module_id, ...@@ -485,8 +499,10 @@ bool allocate_dl_retransmission(module_id_t module_id,
&sched_ctrl->sched_pdcch, &sched_ctrl->sched_pdcch,
false); false);
if (CCEIndex<0) { if (CCEIndex<0) {
LOG_D(MAC, "%4d.%2d could not find CCE for DL DCI retransmission RNTI %04x\n", LOG_D(NR_MAC, "[UE %04x][%4d.%2d] could not find free CCE for DL DCI retransmission\n",
frame, slot, UE->rnti); UE->rnti,
frame,
slot);
return false; return false;
} }
...@@ -496,8 +512,7 @@ bool allocate_dl_retransmission(module_id_t module_id, ...@@ -496,8 +512,7 @@ bool allocate_dl_retransmission(module_id_t module_id,
int r_pucch = nr_get_pucch_resource(sched_ctrl->coreset, ul_bwp->pucch_Config, CCEIndex); int r_pucch = nr_get_pucch_resource(sched_ctrl->coreset, ul_bwp->pucch_Config, CCEIndex);
const int alloc = nr_acknack_scheduling(nr_mac, UE, frame, slot, r_pucch, 0); const int alloc = nr_acknack_scheduling(nr_mac, UE, frame, slot, r_pucch, 0);
if (alloc<0) { if (alloc<0) {
LOG_D(MAC, LOG_D(NR_MAC, "[UE %04x][%4d.%2d] could not find PUCCH for DL DCI retransmission\n",
"could not find PUCCH for UE %04x@%d.%d\n",
UE->rnti, UE->rnti,
frame, frame,
slot); slot);
...@@ -579,7 +594,10 @@ void pf_dl(module_id_t module_id, ...@@ -579,7 +594,10 @@ void pf_dl(module_id_t module_id,
bool r = allocate_dl_retransmission(module_id, frame, slot, rballoc_mask, &n_rb_sched, UE, sched_pdsch->dl_harq_pid); bool r = allocate_dl_retransmission(module_id, frame, slot, rballoc_mask, &n_rb_sched, UE, sched_pdsch->dl_harq_pid);
if (!r) { if (!r) {
LOG_D(NR_MAC, "%4d.%2d retransmission can NOT be allocated\n", frame, slot); LOG_D(NR_MAC, "[UE %04x][%4d.%2d] DL retransmission could not be allocated\n",
UE->rnti,
frame,
slot);
continue; continue;
} }
/* 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 */
...@@ -590,7 +608,10 @@ void pf_dl(module_id_t module_id, ...@@ -590,7 +608,10 @@ void pf_dl(module_id_t module_id,
* if the UE disconnected in L2sim, in which case the gNB is not notified * if the UE disconnected in L2sim, in which case the gNB is not notified
* (this can be considered a design flaw) */ * (this can be considered a design flaw) */
if (sched_ctrl->available_dl_harq.head < 0) { if (sched_ctrl->available_dl_harq.head < 0) {
LOG_D(NR_MAC, "RNTI %04x has no free DL HARQ process, skipping\n", UE->rnti); LOG_D(NR_MAC, "[UE %04x][%4d.%2d] UE has no free DL HARQ process, skipping\n",
UE->rnti,
frame,
slot);
continue; continue;
} }
...@@ -621,8 +642,14 @@ void pf_dl(module_id_t module_id, ...@@ -621,8 +642,14 @@ void pf_dl(module_id_t module_id,
0 /* tb_scaling */, 0 /* tb_scaling */,
sched_pdsch->nrOfLayers) >> 3; sched_pdsch->nrOfLayers) >> 3;
float coeff_ue = (float) tbs / UE->dl_thr_ue; float coeff_ue = (float) tbs / UE->dl_thr_ue;
LOG_D(NR_MAC,"UE %04x b %d, thr_ue %f, tbs %d, coeff_ue %f\n", LOG_D(NR_MAC, "[UE %04x][%4d.%2d] b %d, thr_ue %f, tbs %d, coeff_ue %f\n",
UE->rnti, b, UE->dl_thr_ue, tbs, coeff_ue); UE->rnti,
frame,
slot,
b,
UE->dl_thr_ue,
tbs,
coeff_ue);
/* Create UE_sched list for UEs eligible for new transmission*/ /* Create UE_sched list for UEs eligible for new transmission*/
UE_sched[curUE].coef=coeff_ue; UE_sched[curUE].coef=coeff_ue;
UE_sched[curUE].UE=UE; UE_sched[curUE].UE=UE;
...@@ -651,7 +678,10 @@ void pf_dl(module_id_t module_id, ...@@ -651,7 +678,10 @@ void pf_dl(module_id_t module_id,
int rbStart = 0; // start wrt BWPstart int rbStart = 0; // start wrt BWPstart
if (sched_ctrl->available_dl_harq.head < 0) { if (sched_ctrl->available_dl_harq.head < 0) {
LOG_D(MAC, "RNTI %04x has no free HARQ process, skipping\n", iterator->UE->rnti); LOG_D(NR_MAC, "[UE %04x][%4d.%2d] UE has no free DL HARQ process, skipping\n",
iterator->UE->rnti,
frame,
slot);
iterator++; iterator++;
continue; continue;
} }
...@@ -664,7 +694,10 @@ void pf_dl(module_id_t module_id, ...@@ -664,7 +694,10 @@ void pf_dl(module_id_t module_id,
&sched_ctrl->sched_pdcch, &sched_ctrl->sched_pdcch,
false); false);
if (CCEIndex<0) { if (CCEIndex<0) {
LOG_D(NR_MAC, "%4d.%2d could not find CCE for DL DCI RNTI %04x\n", frame, slot, rnti); LOG_D(NR_MAC, "[UE %04x][%4d.%2d] could not find free CCE for DL DCI\n",
rnti,
frame,
slot);
iterator++; iterator++;
continue; continue;
} }
...@@ -676,8 +709,7 @@ void pf_dl(module_id_t module_id, ...@@ -676,8 +709,7 @@ void pf_dl(module_id_t module_id,
const int alloc = nr_acknack_scheduling(mac, iterator->UE, frame, slot, r_pucch, 0); const int alloc = nr_acknack_scheduling(mac, iterator->UE, frame, slot, r_pucch, 0);
if (alloc<0) { if (alloc<0) {
LOG_D(NR_MAC, LOG_D(NR_MAC, "[UE %04x][%4d.%2d] could not find PUCCH for DL DCI\n",
"could not find PUCCH for %04x@%d.%d\n",
rnti, rnti,
frame, frame,
slot); slot);
......
...@@ -1432,21 +1432,25 @@ static bool allocate_ul_retransmission(gNB_MAC_INST *nrmac, ...@@ -1432,21 +1432,25 @@ static bool allocate_ul_retransmission(gNB_MAC_INST *nrmac,
const uint8_t nrOfLayers = retInfo->nrOfLayers; const uint8_t nrOfLayers = retInfo->nrOfLayers;
LOG_D(NR_MAC,"retInfo->time_domain_allocation = %d, tda = %d\n", retInfo->time_domain_allocation, tda); LOG_D(NR_MAC,"retInfo->time_domain_allocation = %d, tda = %d\n", retInfo->time_domain_allocation, tda);
LOG_D(NR_MAC,"tbs %d\n",retInfo->tb_size); LOG_D(NR_MAC,"tbs %d\n",retInfo->tb_size);
if (tda == retInfo->time_domain_allocation && NR_tda_info_t tda_info = nr_get_pusch_tda_info(&UE->current_UL_BWP, tda);
nrOfLayers == retInfo->nrOfLayers) { bool reuse_old_tda = (retInfo->tda_info.startSymbolIndex == tda_info.startSymbolIndex) && (retInfo->tda_info.nrOfSymbols <= tda_info.nrOfSymbols);
if (reuse_old_tda && nrOfLayers == retInfo->nrOfLayers) {
/* Check the resource is enough for retransmission */ /* Check the resource is enough for retransmission */
const uint16_t slbitmap = SL_to_bitmap(retInfo->tda_info.startSymbolIndex, retInfo->tda_info.nrOfSymbols); const uint16_t slbitmap = SL_to_bitmap(retInfo->tda_info.startSymbolIndex, retInfo->tda_info.nrOfSymbols);
while (rbStart < bwpSize && (rballoc_mask[rbStart] & slbitmap) != slbitmap) 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 RNTI %04x: no resources (rbStart %d, retInfo->rbSize %d, bwpSize %d\n", UE->rnti, rbStart, retInfo->rbSize, bwpSize); LOG_W(NR_MAC, "[UE %04x][%4d.%2d] could not allocate UL retransmission: no resources (rbStart %d, retInfo->rbSize %d, bwpSize %d) \n",
UE->rnti,
frame,
slot,
rbStart,
retInfo->rbSize,
bwpSize);
return false; return false;
} }
LOG_D(NR_MAC, "%s(): retransmission keeping TDA %d and TBS %d\n", __func__, tda, retInfo->tb_size); LOG_D(NR_MAC, "%s(): retransmission keeping TDA %d and TBS %d\n", __func__, tda, retInfo->tb_size);
} else { } else {
NR_tda_info_t tda_info = nr_get_pusch_tda_info(&UE->current_UL_BWP, tda);
NR_pusch_dmrs_t dmrs_info = get_ul_dmrs_params(scc, NR_pusch_dmrs_t dmrs_info = get_ul_dmrs_params(scc,
&UE->current_UL_BWP, &UE->current_UL_BWP,
&tda_info, &tda_info,
...@@ -1472,7 +1476,12 @@ static bool allocate_ul_retransmission(gNB_MAC_INST *nrmac, ...@@ -1472,7 +1476,12 @@ static bool allocate_ul_retransmission(gNB_MAC_INST *nrmac,
&new_tbs, &new_tbs,
&new_rbSize); &new_rbSize);
if (!success || new_tbs != retInfo->tb_size) { if (!success || new_tbs != retInfo->tb_size) {
LOG_D(NR_MAC, "%s(): new TBsize %d of new TDA does not match old TBS %d\n", __func__, new_tbs, retInfo->tb_size); LOG_D(NR_MAC, "[UE %04x][%4d.%2d] allocation of UL retransmission failed: new TBsize %d of new TDA does not match old TBS %d \n",
UE->rnti,
frame,
slot,
new_tbs,
retInfo->tb_size);
return false; /* the maximum TBsize we might have is smaller than what we need */ return false; /* the maximum TBsize we might have is smaller than what we need */
} }
LOG_D(NR_MAC, "%s(): retransmission with TDA %d->%d and TBS %d -> %d\n", __func__, retInfo->time_domain_allocation, tda, retInfo->tb_size, new_tbs); LOG_D(NR_MAC, "%s(): retransmission with TDA %d->%d and TBS %d -> %d\n", __func__, retInfo->time_domain_allocation, tda, retInfo->tb_size, new_tbs);
...@@ -1494,7 +1503,10 @@ static bool allocate_ul_retransmission(gNB_MAC_INST *nrmac, ...@@ -1494,7 +1503,10 @@ static bool allocate_ul_retransmission(gNB_MAC_INST *nrmac,
&sched_ctrl->sched_pdcch, &sched_ctrl->sched_pdcch,
false); false);
if (CCEIndex<0) { if (CCEIndex<0) {
LOG_D(NR_MAC, "%4d.%2d no free CCE for retransmission UL DCI UE %04x\n", frame, slot, UE->rnti); LOG_D(NR_MAC, "[UE %04x][%4d.%2d] no free CCE for retransmission UL DCI UE\n",
UE->rnti,
frame,
slot);
return false; return false;
} }
...@@ -1594,7 +1606,10 @@ void pf_ul(module_id_t module_id, ...@@ -1594,7 +1606,10 @@ void pf_ul(module_id_t module_id,
const int tda = get_ul_tda(nrmac, scc, sched_pusch->frame, sched_pusch->slot); const int tda = get_ul_tda(nrmac, scc, sched_pusch->frame, sched_pusch->slot);
bool r = allocate_ul_retransmission(nrmac, frame, slot, rballoc_mask, &n_rb_sched, UE, sched_pusch->ul_harq_pid, scc, tda); bool r = allocate_ul_retransmission(nrmac, frame, slot, rballoc_mask, &n_rb_sched, UE, sched_pusch->ul_harq_pid, scc, tda);
if (!r) { if (!r) {
LOG_D(NR_MAC, "%4d.%2d UL retransmission UE RNTI %04x can NOT be allocated\n", frame, slot, UE->rnti); LOG_D(NR_MAC, "[UE %04x][%4d.%2d] UL retransmission could not be allocated\n",
UE->rnti,
frame,
slot);
continue; continue;
} }
else LOG_D(NR_MAC,"%4d.%2d UL Retransmission UE RNTI %04x to be allocated, max_num_ue %d\n",frame,slot,UE->rnti,max_num_ue); else LOG_D(NR_MAC,"%4d.%2d UL Retransmission UE RNTI %04x to be allocated, max_num_ue %d\n",frame,slot,UE->rnti,max_num_ue);
...@@ -1608,7 +1623,10 @@ void pf_ul(module_id_t module_id, ...@@ -1608,7 +1623,10 @@ void pf_ul(module_id_t module_id,
* if the UE disconnected in L2sim, in which case the gNB is not notified * if the UE disconnected in L2sim, in which case the gNB is not notified
* (this can be considered a design flaw) */ * (this can be considered a design flaw) */
if (sched_ctrl->available_ul_harq.head < 0) { if (sched_ctrl->available_ul_harq.head < 0) {
LOG_D(NR_MAC, "RNTI %04x has no free UL HARQ process, skipping\n", UE->rnti); LOG_D(NR_MAC, "[UE %04x][%4d.%2d] has no free UL HARQ process, skipping\n",
UE->rnti,
frame,
slot);
continue; continue;
} }
...@@ -1641,7 +1659,10 @@ void pf_ul(module_id_t module_id, ...@@ -1641,7 +1659,10 @@ void pf_ul(module_id_t module_id,
&sched_ctrl->sched_pdcch, &sched_ctrl->sched_pdcch,
false); false);
if (CCEIndex<0) { if (CCEIndex<0) {
LOG_D(NR_MAC, "%4d.%2d no free CCE for UL DCI UE %04x (BSR 0)\n", frame, slot, UE->rnti); LOG_D(NR_MAC, "[UE %04x][%4d.%2d] no free CCE for UL DCI (BSR 0)\n",
UE->rnti,
frame,
slot);
continue; continue;
} }
...@@ -1659,8 +1680,13 @@ void pf_ul(module_id_t module_id, ...@@ -1659,8 +1680,13 @@ void pf_ul(module_id_t module_id,
while (rbStart < bwpSize && (rballoc_mask[rbStart] & slbitmap) != slbitmap) 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 RNTI %04x: no resources (rbStart %d, min_rb %d, bwpSize %d\n", LOG_W(NR_MAC, "[UE %04x][%4d.%2d] could not allocate continuous UL data: no resources (rbStart %d, min_rb %d, bwpSize %d)\n",
UE->rnti,rbStart,min_rb,bwpSize); UE->rnti,
frame,
slot,
rbStart,
min_rb,
bwpSize);
continue; continue;
} }
...@@ -1698,8 +1724,14 @@ void pf_ul(module_id_t module_id, ...@@ -1698,8 +1724,14 @@ void pf_ul(module_id_t module_id,
/* Calculate coefficient*/ /* Calculate coefficient*/
const uint32_t tbs = ul_pf_tbs[current_BWP->mcs_table][sched_pusch->mcs]; const uint32_t tbs = ul_pf_tbs[current_BWP->mcs_table][sched_pusch->mcs];
float coeff_ue = (float) tbs / UE->ul_thr_ue; float coeff_ue = (float) tbs / UE->ul_thr_ue;
LOG_D(NR_MAC,"rnti %04x b %d, ul_thr_ue %f, tbs %d, coeff_ue %f\n", LOG_D(NR_MAC, "[UE %04x][%4d.%2d] b %d, ul_thr_ue %f, tbs %d, coeff_ue %f\n",
UE->rnti, b, UE->ul_thr_ue, tbs, coeff_ue); UE->rnti,
frame,
slot,
b,
UE->ul_thr_ue,
tbs,
coeff_ue);
UE_sched[curUE].coef=coeff_ue; UE_sched[curUE].coef=coeff_ue;
UE_sched[curUE].UE=UE; UE_sched[curUE].UE=UE;
curUE++; curUE++;
...@@ -1721,7 +1753,10 @@ void pf_ul(module_id_t module_id, ...@@ -1721,7 +1753,10 @@ void pf_ul(module_id_t module_id,
false); false);
if (CCEIndex<0) { if (CCEIndex<0) {
LOG_D(NR_MAC, "%4d.%2d no free CCE for UL DCI UE %04x\n", frame, slot, iterator->UE->rnti); LOG_D(NR_MAC, "[UE %04x][%4d.%2d] no free CCE for UL DCI\n",
iterator->UE->rnti,
frame,
slot);
iterator++; iterator++;
continue; continue;
} }
...@@ -1750,7 +1785,13 @@ void pf_ul(module_id_t module_id, ...@@ -1750,7 +1785,13 @@ void pf_ul(module_id_t module_id,
max_rbSize++; max_rbSize++;
if (rbStart + min_rb >= bwpSize || max_rbSize < min_rb) { if (rbStart + min_rb >= bwpSize || max_rbSize < min_rb) {
LOG_D(NR_MAC, "cannot allocate UL data for RNTI %04x: no resources (rbStart %d, min_rb %d, bwpSize %d)\n", iterator->UE->rnti, rbStart, min_rb, bwpSize); LOG_D(NR_MAC, "[UE %04x][%4d.%2d] could not allocate UL data: no resources (rbStart %d, min_rb %d, bwpSize %d)\n",
iterator->UE->rnti,
frame,
slot,
rbStart,
min_rb,
bwpSize);
iterator++; iterator++;
continue; continue;
} else } else
......
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