From 8934c7db1017991dfc6d767ef0f7524e87e91d81 Mon Sep 17 00:00:00 2001 From: francescomani Date: Thu, 5 Oct 2023 18:09:02 +0200 Subject: [PATCH] fix the selection of DCI candidates at UE --- .../NR_MAC_UE/nr_ue_dci_configuration.c | 42 ++++++++++++------- 1 file changed, 26 insertions(+), 16 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c index 7055f2729d..d89dc44ef3 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c @@ -46,34 +46,44 @@ void fill_dci_search_candidates(const NR_SearchSpace_t *ss, { LOG_D(NR_MAC,"Filling search candidates for DCI\n"); - rel15->number_of_candidates = 0; int i = 0; for (int maxL = 16; maxL > 0; maxL >>= 1) { - uint8_t aggregation, number_of_candidates; + uint8_t aggregation, max_number_of_candidates; find_aggregation_candidates(&aggregation, - &number_of_candidates, + &max_number_of_candidates, ss, maxL); - if (number_of_candidates > 0) { - LOG_D(NR_MAC,"L %d, number of candidates %d, aggregation %d\n", maxL, number_of_candidates, aggregation); - int N_cce_sym = 0; // nb of rbs of coreset per symbol - for (int f = 0; f < 6; f++) { - for (int t = 0; t < 8; t++) { - N_cce_sym += ((rel15->coreset.frequency_domain_resource[f] >> t) & 1); + if (max_number_of_candidates == 0) + continue; + LOG_D(NR_MAC,"L %d, max number of candidates %d, aggregation %d\n", maxL, max_number_of_candidates, aggregation); + int N_cce_sym = 0; // nb of rbs of coreset per symbol + for (int f = 0; f < 6; f++) { + for (int t = 0; t < 8; t++) { + N_cce_sym += ((rel15->coreset.frequency_domain_resource[f] >> t) & 1); + } + } + int N_cces = N_cce_sym * rel15->coreset.duration; + if (N_cces < aggregation) + continue; + for (int j = 0; j < max_number_of_candidates; j++) { + int first_cce = aggregation * ((Y + ((j * N_cces) / (aggregation * max_number_of_candidates)) + 0) % (N_cces / aggregation)); + LOG_D(NR_MAC,"Candidate %d of %d first_cce %d (L %d N_cces %d Y %d)\n", j, max_number_of_candidates, first_cce, aggregation, N_cces, Y); + // to avoid storing more than one candidate with the same aggregation and starting CCE (duplicated candidate) + bool duplicated = false; + for (int k = 0; k < i; k++) { + if (rel15->CCE[k] == first_cce && rel15->L[k] == aggregation) { + duplicated = true; + LOG_D(NR_MAC, "Candidate %d of %d is duplicated\n", j, max_number_of_candidates); } } - int N_cces = N_cce_sym * rel15->coreset.duration; - // limit the number of candidates to the ones fitting current configuration - int max_candidates = min(N_cces / aggregation, number_of_candidates); - rel15->number_of_candidates += max_candidates; - for (int j = 0; j < max_candidates; i++, j++) { - int first_cce = aggregation * ((Y + ((j * N_cces) / (aggregation * number_of_candidates)) + 0) % (N_cces / aggregation)); - LOG_D(NR_MAC,"Candidate %d of %d first_cce %d (L %d N_cces %d Y %d)\n", j, max_candidates, first_cce, aggregation, N_cces, Y); + if (!duplicated) { rel15->CCE[i] = first_cce; rel15->L[i] = aggregation; + i++; } } } + rel15->number_of_candidates = i; } NR_ControlResourceSet_t *ue_get_coreset(const NR_UE_MAC_INST_t *mac, const int coreset_id)