Refactor TDA allocation
Make it simpler to see, in function nr_rrc_config_ul_tda(), which UL TDAs we allocate for a UE.
This commit is contained in:
@@ -1048,58 +1048,34 @@ void nr_rrc_config_dl_tda(struct NR_PDSCH_TimeDomainResourceAllocationList *pdsc
|
||||
}
|
||||
}
|
||||
|
||||
static struct NR_PUSCH_TimeDomainResourceAllocation *set_TimeDomainResourceAllocation(const int k2, uint8_t index, int ul_symb)
|
||||
static struct NR_PUSCH_TimeDomainResourceAllocation *set_TimeDomainResourceAllocation(const int k2, long sliv)
|
||||
{
|
||||
struct NR_PUSCH_TimeDomainResourceAllocation *puschTdrAlloc = calloc_or_fail(1, sizeof(*puschTdrAlloc));
|
||||
puschTdrAlloc->k2 = calloc_or_fail(1, sizeof(*puschTdrAlloc->k2));
|
||||
*puschTdrAlloc->k2 = k2;
|
||||
puschTdrAlloc->mappingType = NR_PUSCH_TimeDomainResourceAllocation__mappingType_typeB;
|
||||
switch (index) {
|
||||
case 0:
|
||||
puschTdrAlloc->startSymbolAndLength = get_SLIV(0, 13);
|
||||
break;
|
||||
case 1:
|
||||
puschTdrAlloc->startSymbolAndLength = get_SLIV(0, 12);
|
||||
break;
|
||||
case 2:
|
||||
// UL TDA index 2 for mixed slot (TDD)
|
||||
puschTdrAlloc->startSymbolAndLength =
|
||||
get_SLIV(NR_NUMBER_OF_SYMBOLS_PER_SLOT - ul_symb, ul_symb - 1); // starting in fist ul symbol til the last but one
|
||||
break;
|
||||
case 3: {
|
||||
// UL TDA index 3 for msg3 in the mixed slot (TDD)
|
||||
int no_mix_slot = ul_symb < 3 ? 1 : 0; // we need at least 2 symbols for scheduling Msg3
|
||||
*puschTdrAlloc->k2 += no_mix_slot;
|
||||
if (no_mix_slot)
|
||||
puschTdrAlloc->startSymbolAndLength = get_SLIV(0, 13); // full allocation if there is no mixed slot
|
||||
else
|
||||
puschTdrAlloc->startSymbolAndLength =
|
||||
get_SLIV(NR_NUMBER_OF_SYMBOLS_PER_SLOT - ul_symb, ul_symb - 1); // starting in fist ul symbol til the last but one
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
puschTdrAlloc->startSymbolAndLength = sliv;
|
||||
return puschTdrAlloc;
|
||||
}
|
||||
|
||||
void nr_rrc_config_ul_tda(NR_ServingCellConfigCommon_t *scc, int min_fb_delay)
|
||||
{
|
||||
//TODO change to accomodate for SRS
|
||||
|
||||
const NR_PUSCH_TimeDomainResourceAllocationList_t *tda =
|
||||
NR_PUSCH_TimeDomainResourceAllocationList_t *tda_list =
|
||||
scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList;
|
||||
AssertFatal(tda->list.count == 0, "already have pusch_TimeDomainAllocationList members\n");
|
||||
AssertFatal(tda_list->list.count == 0, "already have pusch_TimeDomainAllocationList members\n");
|
||||
|
||||
const int k2 = min_fb_delay;
|
||||
|
||||
int mu = scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.subcarrierSpacing;
|
||||
struct NR_SetupRelease_PUSCH_ConfigCommon *pusch_ConfigCommon = scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon;
|
||||
|
||||
// UL TDA index 0 is basic slot configuration starting in symbol 0 til the last but one symbol
|
||||
asn1cSeqAdd(&pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list, set_TimeDomainResourceAllocation(k2, 0, 0));
|
||||
NR_PUSCH_TimeDomainResourceAllocation_t *tda;
|
||||
tda = set_TimeDomainResourceAllocation(k2, get_SLIV(0, 13));
|
||||
asn1cSeqAdd(&tda_list->list, tda);
|
||||
|
||||
// UL TDA index 1 in case of SRS
|
||||
asn1cSeqAdd(&pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list, set_TimeDomainResourceAllocation(k2, 1, 0));
|
||||
tda = set_TimeDomainResourceAllocation(k2, get_SLIV(0, 12));
|
||||
asn1cSeqAdd(&tda_list->list, tda);
|
||||
|
||||
if (scc->tdd_UL_DL_ConfigurationCommon) {
|
||||
int ul_symb = 0;
|
||||
@@ -1117,21 +1093,24 @@ void nr_rrc_config_ul_tda(NR_ServingCellConfigCommon_t *scc, int min_fb_delay)
|
||||
}
|
||||
if (ul_symb>1) {
|
||||
// UL TDA index 2 for mixed slot (TDD)
|
||||
asn1cSeqAdd(&pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list,
|
||||
set_TimeDomainResourceAllocation(k2, 2, ul_symb));
|
||||
long sliv = get_SLIV(NR_NUMBER_OF_SYMBOLS_PER_SLOT - ul_symb, ul_symb - 1);
|
||||
tda = set_TimeDomainResourceAllocation(k2, sliv);
|
||||
asn1cSeqAdd(&tda_list->list, tda);
|
||||
}
|
||||
// UL TDA index 3 for msg3 in the mixed slot (TDD)
|
||||
int tdd_period_idx = get_tdd_period_idx(scc->tdd_UL_DL_ConfigurationCommon);
|
||||
int nb_periods_per_frame = get_nb_periods_per_frame(tdd_period_idx);
|
||||
int nb_slots_per_period = ((1 << mu) * 10) / nb_periods_per_frame;
|
||||
int k2_msg3 = nb_slots_per_period - get_delta_for_k2(mu);
|
||||
struct NR_PUSCH_TimeDomainResourceAllocation *puschTdrAllocMsg3 = set_TimeDomainResourceAllocation(k2_msg3, 3, ul_symb);
|
||||
bool no_mix_slot = ul_symb < 3; // we need at least 2 symbols for scheduling Msg3
|
||||
long sliv = no_mix_slot ? get_SLIV(0, 13) : get_SLIV(NR_NUMBER_OF_SYMBOLS_PER_SLOT - ul_symb, ul_symb - 1);
|
||||
struct NR_PUSCH_TimeDomainResourceAllocation *puschTdrAllocMsg3 = set_TimeDomainResourceAllocation(k2_msg3, sliv);
|
||||
if (*puschTdrAllocMsg3->k2 < min_fb_delay)
|
||||
*puschTdrAllocMsg3->k2 += nb_slots_per_period;
|
||||
AssertFatal(*puschTdrAllocMsg3->k2 < 33,
|
||||
"Computed k2 for msg3 %ld is larger than the range allowed by RRC (0..32)\n",
|
||||
*puschTdrAllocMsg3->k2);
|
||||
asn1cSeqAdd(&pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list, puschTdrAllocMsg3);
|
||||
asn1cSeqAdd(&tda_list->list, puschTdrAllocMsg3);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user