From e9ff5ee5625c49be333a5e82df51a692a570acd2 Mon Sep 17 00:00:00 2001 From: francescomani Date: Tue, 21 Feb 2023 17:59:15 +0100 Subject: [PATCH] improving the logic of reusing the old tda and applying to UL --- .../LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c | 20 ++++++++----------- .../LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c | 8 +++----- 2 files changed, 11 insertions(+), 17 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c index 8a2748a713..7cd98a5e28 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c @@ -383,7 +383,8 @@ bool allocate_dl_retransmission(module_id_t module_id, uint16_t *rballoc_mask, int *n_rb_sched, NR_UE_info_t *UE, - int current_harq_pid) { + int current_harq_pid) +{ int CC_id = 0; gNB_MAC_INST *nr_mac = RC.nrmac[module_id]; @@ -411,24 +412,19 @@ bool allocate_dl_retransmission(module_id_t module_id, /* Check first whether the old TDA can be reused * 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); - const uint16_t temp_bitmap = SL_to_bitmap(temp_tda.startSymbolIndex, temp_tda.nrOfSymbols); - NR_tda_info_t *old_tda = &retInfo->tda_info; - const uint16_t old_bitmap = SL_to_bitmap(old_tda->startSymbolIndex, old_tda->nrOfSymbols); - bool reuse_old_tda = (old_bitmap & temp_bitmap) == old_bitmap; + 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"); - - if ((reuse_old_tda || tda == retInfo->time_domain_allocation) && - layers == retInfo->nrOfLayers) { + UE->rnti, + reuse_old_tda ? "reuse" : "do not reuse", + layers == retInfo->nrOfLayers ? "same" : "different"); + if (reuse_old_tda && layers == retInfo->nrOfLayers) { /* Check that there are enough resources for retransmission */ while (rbSize < retInfo->rbSize) { rbStart += rbSize; /* last iteration rbSize was not enough, skip it */ rbSize = 0; - const uint16_t slbitmap = reuse_old_tda ? old_bitmap : temp_bitmap; + const uint16_t slbitmap = SL_to_bitmap(retInfo->tda_info.startSymbolIndex, retInfo->tda_info.nrOfSymbols); while (rbStart < bwpSize && (rballoc_mask[rbStart] & slbitmap) != slbitmap) rbStart++; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c index b9baad6e2c..52296561a9 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c @@ -1432,9 +1432,9 @@ static bool allocate_ul_retransmission(gNB_MAC_INST *nrmac, 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,"tbs %d\n",retInfo->tb_size); - if (tda == retInfo->time_domain_allocation && - nrOfLayers == retInfo->nrOfLayers) { - + NR_tda_info_t tda_info = nr_get_pusch_tda_info(&UE->current_UL_BWP, tda); + 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 */ const uint16_t slbitmap = SL_to_bitmap(retInfo->tda_info.startSymbolIndex, retInfo->tda_info.nrOfSymbols); while (rbStart < bwpSize && (rballoc_mask[rbStart] & slbitmap) != slbitmap) @@ -1451,8 +1451,6 @@ static bool allocate_ul_retransmission(gNB_MAC_INST *nrmac, } LOG_D(NR_MAC, "%s(): retransmission keeping TDA %d and TBS %d\n", __func__, tda, retInfo->tb_size); } 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, &UE->current_UL_BWP, &tda_info,