Commit 39cf6006 authored by Robert Schmidt's avatar Robert Schmidt

Merge remote-tracking branch 'origin/NR_ULSCH_scheduler_fixes' into integration_2022_wk46

parents 03640f23 623d0e36
...@@ -1386,7 +1386,7 @@ int64_t *get_prach_config_info(frequency_range_t freq_range, ...@@ -1386,7 +1386,7 @@ int64_t *get_prach_config_info(frequency_range_t freq_range,
void find_aggregation_candidates(uint8_t *aggregation_level, void find_aggregation_candidates(uint8_t *aggregation_level,
uint8_t *nr_of_candidates, uint8_t *nr_of_candidates,
NR_SearchSpace_t *ss, const NR_SearchSpace_t *ss,
int L) { int L) {
AssertFatal(L>=1 && L<=16,"L %d not ok\n",L); AssertFatal(L>=1 && L<=16,"L %d not ok\n",L);
*nr_of_candidates = 0; *nr_of_candidates = 0;
...@@ -3931,7 +3931,7 @@ uint8_t get_BG(uint32_t A, uint16_t R) { ...@@ -3931,7 +3931,7 @@ uint8_t get_BG(uint32_t A, uint16_t R) {
return 1; return 1;
} }
uint32_t get_Y(NR_SearchSpace_t *ss, int slot, rnti_t rnti) { uint32_t get_Y(const NR_SearchSpace_t *ss, int slot, rnti_t rnti) {
if(ss->searchSpaceType->present == NR_SearchSpace__searchSpaceType_PR_common) if(ss->searchSpaceType->present == NR_SearchSpace__searchSpaceType_PR_common)
return 0; return 0;
......
...@@ -50,7 +50,7 @@ typedef enum { ...@@ -50,7 +50,7 @@ typedef enum {
typeB = 1 typeB = 1
} mappingType_t; } mappingType_t;
uint32_t get_Y(NR_SearchSpace_t *ss, int slot, rnti_t rnti); uint32_t get_Y(const NR_SearchSpace_t *ss, int slot, rnti_t rnti);
uint8_t get_BG(uint32_t A, uint16_t R); uint8_t get_BG(uint32_t A, uint16_t R);
...@@ -90,7 +90,7 @@ uint16_t nr_dci_size(const NR_BWP_DownlinkCommon_t *initialDLBWP, ...@@ -90,7 +90,7 @@ uint16_t nr_dci_size(const NR_BWP_DownlinkCommon_t *initialDLBWP,
void find_aggregation_candidates(uint8_t *aggregation_level, void find_aggregation_candidates(uint8_t *aggregation_level,
uint8_t *nr_of_candidates, uint8_t *nr_of_candidates,
NR_SearchSpace_t *ss, const NR_SearchSpace_t *ss,
int maxL); int maxL);
void find_monitoring_periodicity_offset_common(NR_SearchSpace_t *ss, void find_monitoring_periodicity_offset_common(NR_SearchSpace_t *ss,
......
...@@ -792,20 +792,13 @@ void nr_generate_Msg3_retransmission(module_id_t module_idP, int CC_id, frame_t ...@@ -792,20 +792,13 @@ void nr_generate_Msg3_retransmission(module_id_t module_idP, int CC_id, frame_t
} }
uint8_t aggregation_level; uint8_t aggregation_level;
uint8_t nr_of_candidates; int CCEIndex = get_cce_index(nr_mac,
for (int i=0; i<5; i++) { CC_id, slot, 0,
// for now taking the lowest value among the available aggregation levels &aggregation_level,
find_aggregation_candidates(&aggregation_level, &nr_of_candidates, ss, 1<<i); ss,
if(nr_of_candidates>0) break; coreset,
} &ra->sched_pdcch,
AssertFatal(nr_of_candidates>0,"nr_of_candidates is 0\n"); true);
int CCEIndex = find_pdcch_candidate(nr_mac,
CC_id,
aggregation_level,
nr_of_candidates,
&ra->sched_pdcch,
coreset,
0);
if (CCEIndex < 0) { if (CCEIndex < 0) {
LOG_E(NR_MAC, "%s(): cannot find free CCE for RA RNTI 0x%04x!\n", __func__, ra->rnti); LOG_E(NR_MAC, "%s(): cannot find free CCE for RA RNTI 0x%04x!\n", __func__, ra->rnti);
return; return;
...@@ -1188,21 +1181,13 @@ void nr_generate_Msg2(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra ...@@ -1188,21 +1181,13 @@ void nr_generate_Msg2(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
} }
uint8_t aggregation_level; uint8_t aggregation_level;
uint8_t nr_of_candidates; int CCEIndex = get_cce_index(nr_mac,
for (int i=0; i<5; i++) { CC_id, slotP, 0,
// for now taking the lowest value among the available aggregation levels &aggregation_level,
find_aggregation_candidates(&aggregation_level, &nr_of_candidates, ss, 1<<i); ss,
if(nr_of_candidates>0) break; coreset,
} &ra->sched_pdcch,
AssertFatal(nr_of_candidates>0,"nr_of_candidates is 0\n"); true);
int CCEIndex = find_pdcch_candidate(nr_mac,
CC_id,
aggregation_level,
nr_of_candidates,
&ra->sched_pdcch,
coreset,
0);
if (CCEIndex < 0) { if (CCEIndex < 0) {
LOG_E(NR_MAC, "%s(): cannot find free CCE for RA RNTI 0x%04x!\n", __func__, ra->rnti); LOG_E(NR_MAC, "%s(): cannot find free CCE for RA RNTI 0x%04x!\n", __func__, ra->rnti);
...@@ -1446,21 +1431,13 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra ...@@ -1446,21 +1431,13 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
// get CCEindex, needed also for PUCCH and then later for PDCCH // get CCEindex, needed also for PUCCH and then later for PDCCH
uint8_t aggregation_level; uint8_t aggregation_level;
uint8_t nr_of_candidates; int CCEIndex = get_cce_index(nr_mac,
for (int i=0; i<5; i++) { CC_id, slotP, 0,
// for now taking the lowest value among the available aggregation levels &aggregation_level,
find_aggregation_candidates(&aggregation_level, &nr_of_candidates, ss, 1<<i); ss,
if(nr_of_candidates>0) break; coreset,
} &ra->sched_pdcch,
AssertFatal(nr_of_candidates>0,"nr_of_candidates is 0\n"); true);
int CCEIndex = find_pdcch_candidate(nr_mac,
CC_id,
aggregation_level,
nr_of_candidates,
&ra->sched_pdcch,
coreset,
0);
if (CCEIndex < 0) { if (CCEIndex < 0) {
LOG_E(NR_MAC, "%s(): cannot find free CCE for RA RNTI 0x%04x!\n", __func__, ra->rnti); LOG_E(NR_MAC, "%s(): cannot find free CCE for RA RNTI 0x%04x!\n", __func__, ra->rnti);
...@@ -1522,7 +1499,7 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra ...@@ -1522,7 +1499,7 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
const int delta_PRI=0; const int delta_PRI=0;
int r_pucch = nr_get_pucch_resource(coreset, ra->UL_BWP.pucch_Config, CCEIndex); int r_pucch = nr_get_pucch_resource(coreset, ra->UL_BWP.pucch_Config, CCEIndex);
LOG_D(NR_MAC,"[RAPROC] Msg4 r_pucch %d (CCEIndex %d, nb_of_candidates %d, delta_PRI %d)\n", r_pucch, CCEIndex, nr_of_candidates, delta_PRI); LOG_D(NR_MAC,"[RAPROC] Msg4 r_pucch %d (CCEIndex %d, delta_PRI %d)\n", r_pucch, CCEIndex, delta_PRI);
int alloc = nr_acknack_scheduling(nr_mac, UE, frameP, slotP, r_pucch, 1); int alloc = nr_acknack_scheduling(nr_mac, UE, frameP, slotP, r_pucch, 1);
if (alloc<0) { if (alloc<0) {
......
...@@ -385,6 +385,7 @@ bool allocate_dl_retransmission(module_id_t module_id, ...@@ -385,6 +385,7 @@ bool allocate_dl_retransmission(module_id_t module_id,
NR_UE_info_t *UE, 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]; gNB_MAC_INST *nr_mac = RC.nrmac[module_id];
const NR_ServingCellConfigCommon_t *scc = nr_mac->common_channels->ServingCellConfigCommon; const NR_ServingCellConfigCommon_t *scc = nr_mac->common_channels->ServingCellConfigCommon;
NR_UE_sched_ctrl_t *sched_ctrl = &UE->UE_sched_ctrl; NR_UE_sched_ctrl_t *sched_ctrl = &UE->UE_sched_ctrl;
...@@ -400,11 +401,11 @@ bool allocate_dl_retransmission(module_id_t module_id, ...@@ -400,11 +401,11 @@ bool allocate_dl_retransmission(module_id_t module_id,
int pm_index = (curInfo->nrOfLayers < retInfo->nrOfLayers) ? curInfo->pm_index : retInfo->pm_index; int pm_index = (curInfo->nrOfLayers < retInfo->nrOfLayers) ? curInfo->pm_index : retInfo->pm_index;
const int coresetid = sched_ctrl->coreset->controlResourceSetId; const int coresetid = sched_ctrl->coreset->controlResourceSetId;
const uint16_t bwpSize = coresetid == 0 ? RC.nrmac[module_id]->cset0_bwp_size : dl_bwp->BWPSize; const uint16_t bwpSize = coresetid == 0 ? nr_mac->cset0_bwp_size : dl_bwp->BWPSize;
int rbStart = 0; // start wrt BWPstart int rbStart = 0; // start wrt BWPstart
int rbSize = 0; int rbSize = 0;
const int tda = get_dl_tda(RC.nrmac[module_id], 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 && if (tda == retInfo->time_domain_allocation &&
...@@ -476,28 +477,13 @@ bool allocate_dl_retransmission(module_id_t module_id, ...@@ -476,28 +477,13 @@ bool allocate_dl_retransmission(module_id_t module_id,
} }
/* Find a free CCE */ /* Find a free CCE */
int CCEIndex = get_cce_index(nr_mac,
const uint32_t Y = get_Y(sched_ctrl->search_space, slot, UE->rnti); CC_id, slot, UE->rnti,
uint8_t nr_of_candidates; &sched_ctrl->aggregation_level,
sched_ctrl->search_space,
for (int i=0; i<5; i++) { sched_ctrl->coreset,
// for now taking the lowest value among the available aggregation levels &sched_ctrl->sched_pdcch,
find_aggregation_candidates(&sched_ctrl->aggregation_level, false);
&nr_of_candidates,
sched_ctrl->search_space,
1<<i);
if(nr_of_candidates>0) break;
}
int CCEIndex = find_pdcch_candidate(RC.nrmac[module_id],
/* CC_id = */ 0,
sched_ctrl->aggregation_level,
nr_of_candidates,
&sched_ctrl->sched_pdcch,
sched_ctrl->coreset,
Y);
if (CCEIndex<0) { if (CCEIndex<0) {
LOG_D(MAC, "%4d.%2d could not find CCE for DL DCI retransmission RNTI %04x\n", LOG_D(MAC, "%4d.%2d could not find CCE for DL DCI retransmission RNTI %04x\n",
frame, slot, UE->rnti); frame, slot, UE->rnti);
...@@ -519,7 +505,7 @@ bool allocate_dl_retransmission(module_id_t module_id, ...@@ -519,7 +505,7 @@ bool allocate_dl_retransmission(module_id_t module_id,
} }
sched_ctrl->cce_index = CCEIndex; sched_ctrl->cce_index = CCEIndex;
fill_pdcch_vrb_map(RC.nrmac[module_id], fill_pdcch_vrb_map(nr_mac,
/* CC_id = */ 0, /* CC_id = */ 0,
&sched_ctrl->sched_pdcch, &sched_ctrl->sched_pdcch,
CCEIndex, CCEIndex,
...@@ -560,6 +546,7 @@ void pf_dl(module_id_t module_id, ...@@ -560,6 +546,7 @@ void pf_dl(module_id_t module_id,
UEsched_t UE_sched[MAX_MOBILES_PER_GNB] = {0}; UEsched_t UE_sched[MAX_MOBILES_PER_GNB] = {0};
int remainUEs = max_num_ue; int remainUEs = max_num_ue;
int curUE = 0; int curUE = 0;
int CC_id = 0;
/* Loop UE_info->list to check retransmission */ /* Loop UE_info->list to check retransmission */
UE_iterator(UE_list, UE) { UE_iterator(UE_list, UE) {
...@@ -569,7 +556,8 @@ void pf_dl(module_id_t module_id, ...@@ -569,7 +556,8 @@ void pf_dl(module_id_t module_id,
NR_UE_sched_ctrl_t *sched_ctrl = &UE->UE_sched_ctrl; NR_UE_sched_ctrl_t *sched_ctrl = &UE->UE_sched_ctrl;
NR_UE_DL_BWP_t *current_BWP = &UE->current_DL_BWP; NR_UE_DL_BWP_t *current_BWP = &UE->current_DL_BWP;
if (sched_ctrl->ul_failure==1 && get_softmodem_params()->phy_test==0) continue; if (sched_ctrl->ul_failure==1)
continue;
const NR_mac_dir_stats_t *stats = &UE->mac_stats.dl; const NR_mac_dir_stats_t *stats = &UE->mac_stats.dl;
NR_sched_pdsch_t *sched_pdsch = &sched_ctrl->sched_pdsch; NR_sched_pdsch_t *sched_pdsch = &sched_ctrl->sched_pdsch;
...@@ -580,6 +568,9 @@ void pf_dl(module_id_t module_id, ...@@ -580,6 +568,9 @@ void pf_dl(module_id_t module_id,
const uint32_t b = UE->mac_stats.dl.current_bytes; const uint32_t b = UE->mac_stats.dl.current_bytes;
UE->dl_thr_ue = (1 - a) * UE->dl_thr_ue + a * b; UE->dl_thr_ue = (1 - a) * UE->dl_thr_ue + a * b;
if (remainUEs == 0)
continue;
/* retransmission */ /* retransmission */
if (sched_pdsch->dl_harq_pid >= 0) { if (sched_pdsch->dl_harq_pid >= 0) {
/* Allocate retransmission */ /* Allocate retransmission */
...@@ -589,15 +580,9 @@ void pf_dl(module_id_t module_id, ...@@ -589,15 +580,9 @@ void pf_dl(module_id_t module_id,
LOG_D(NR_MAC, "%4d.%2d retransmission can NOT be allocated\n", frame, slot); LOG_D(NR_MAC, "%4d.%2d retransmission can NOT be allocated\n", 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 */
remainUEs--; remainUEs--;
// we have filled all with mandatory retransmissions
// no need to schedule new transmissions
if (remainUEs == 0)
return;
} else { } else {
/* skip this UE if there are no free HARQ processes. This can happen e.g. /* skip this UE if there are no free HARQ processes. This can happen e.g.
* 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
...@@ -659,7 +644,7 @@ void pf_dl(module_id_t module_id, ...@@ -659,7 +644,7 @@ void pf_dl(module_id_t module_id,
const int coresetid = sched_ctrl->coreset->controlResourceSetId; const int coresetid = sched_ctrl->coreset->controlResourceSetId;
const uint16_t bwpSize = coresetid == 0 ? const uint16_t bwpSize = coresetid == 0 ?
RC.nrmac[module_id]->cset0_bwp_size : mac->cset0_bwp_size :
dl_bwp->BWPSize; dl_bwp->BWPSize;
int rbStart = 0; // start wrt BWPstart int rbStart = 0; // start wrt BWPstart
...@@ -669,28 +654,13 @@ void pf_dl(module_id_t module_id, ...@@ -669,28 +654,13 @@ void pf_dl(module_id_t module_id,
continue; continue;
} }
/* Find a free CCE */ int CCEIndex = get_cce_index(mac,
const uint32_t Y = get_Y(sched_ctrl->search_space, slot, iterator->UE->rnti); CC_id, slot, iterator->UE->rnti,
uint8_t nr_of_candidates; &sched_ctrl->aggregation_level,
sched_ctrl->search_space,
for (int i=0; i<5; i++) { sched_ctrl->coreset,
// for now taking the lowest value among the available aggregation levels &sched_ctrl->sched_pdcch,
find_aggregation_candidates(&sched_ctrl->aggregation_level, false);
&nr_of_candidates,
sched_ctrl->search_space,
1<<i);
if(nr_of_candidates>0) break;
}
int CCEIndex = find_pdcch_candidate(mac,
/* CC_id = */ 0,
sched_ctrl->aggregation_level,
nr_of_candidates,
&sched_ctrl->sched_pdcch,
sched_ctrl->coreset,
Y);
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, "%4d.%2d could not find CCE for DL DCI RNTI %04x\n", frame, slot, rnti);
iterator++; iterator++;
...@@ -722,7 +692,7 @@ void pf_dl(module_id_t module_id, ...@@ -722,7 +692,7 @@ void pf_dl(module_id_t module_id,
/* MCS has been set above */ /* MCS has been set above */
NR_sched_pdsch_t *sched_pdsch = &sched_ctrl->sched_pdsch; NR_sched_pdsch_t *sched_pdsch = &sched_ctrl->sched_pdsch;
sched_pdsch->time_domain_allocation = get_dl_tda(RC.nrmac[module_id], scc, slot); sched_pdsch->time_domain_allocation = get_dl_tda(mac, scc, slot);
AssertFatal(sched_pdsch->time_domain_allocation>=0,"Unable to find PDSCH time domain allocation in list\n"); AssertFatal(sched_pdsch->time_domain_allocation>=0,"Unable to find PDSCH time domain allocation in list\n");
sched_pdsch->tda_info = nr_get_pdsch_tda_info(dl_bwp, sched_pdsch->time_domain_allocation); sched_pdsch->tda_info = nr_get_pdsch_tda_info(dl_bwp, sched_pdsch->time_domain_allocation);
......
...@@ -250,27 +250,13 @@ void nr_preprocessor_phytest(module_id_t module_id, ...@@ -250,27 +250,13 @@ void nr_preprocessor_phytest(module_id_t module_id,
0); 0);
sched_ctrl->num_total_bytes += sched_ctrl->rlc_status[lcid].bytes_in_buffer; sched_ctrl->num_total_bytes += sched_ctrl->rlc_status[lcid].bytes_in_buffer;
uint8_t nr_of_candidates; int CCEIndex = get_cce_index(RC.nrmac[module_id],
for (int i=0; i<5; i++) { CC_id, slot, UE->rnti,
// for now taking the lowest value among the available aggregation levels &sched_ctrl->aggregation_level,
find_aggregation_candidates(&sched_ctrl->aggregation_level, sched_ctrl->search_space,
&nr_of_candidates, sched_ctrl->coreset,
sched_ctrl->search_space, &sched_ctrl->sched_pdcch,
1<<i); false);
if(nr_of_candidates>0) break;
}
AssertFatal(nr_of_candidates>0,"nr_of_candidates is 0\n");
const uint32_t Y = get_Y(sched_ctrl->search_space, slot, UE->rnti);
int CCEIndex = find_pdcch_candidate(RC.nrmac[module_id],
CC_id,
sched_ctrl->aggregation_level,
nr_of_candidates,
&sched_ctrl->sched_pdcch,
sched_ctrl->coreset,
Y);
AssertFatal(CCEIndex >= 0, AssertFatal(CCEIndex >= 0,
"%s(): could not find CCE for UE %04x\n", "%s(): could not find CCE for UE %04x\n",
__func__, __func__,
...@@ -412,27 +398,13 @@ bool nr_ul_preprocessor_phytest(module_id_t module_id, frame_t frame, sub_frame_ ...@@ -412,27 +398,13 @@ bool nr_ul_preprocessor_phytest(module_id_t module_id, frame_t frame, sub_frame_
sched_ctrl->sched_pusch.slot = sched_slot; sched_ctrl->sched_pusch.slot = sched_slot;
sched_ctrl->sched_pusch.frame = sched_frame; sched_ctrl->sched_pusch.frame = sched_frame;
uint8_t nr_of_candidates; int CCEIndex = get_cce_index(nr_mac,
for (int i=0; i<5; i++) { CC_id, slot, UE->rnti,
// for now taking the lowest value among the available aggregation levels &sched_ctrl->aggregation_level,
find_aggregation_candidates(&sched_ctrl->aggregation_level, sched_ctrl->search_space,
&nr_of_candidates, sched_ctrl->coreset,
sched_ctrl->search_space, &sched_ctrl->sched_pdcch,
1<<i); false);
if(nr_of_candidates>0) break;
}
AssertFatal(nr_of_candidates>0,"nr_of_candidates is 0\n");
const uint32_t Y = get_Y(sched_ctrl->search_space, slot, UE->rnti);
int CCEIndex = find_pdcch_candidate(nr_mac,
CC_id,
sched_ctrl->aggregation_level,
nr_of_candidates,
&sched_ctrl->sched_pdcch,
sched_ctrl->coreset,
Y);
if (CCEIndex < 0) { if (CCEIndex < 0) {
LOG_E(MAC, "%s(): CCE list not empty, couldn't schedule PUSCH\n", __func__); LOG_E(MAC, "%s(): CCE list not empty, couldn't schedule PUSCH\n", __func__);
return false; return false;
......
...@@ -114,10 +114,6 @@ uint8_t nr_ss_first_symb_idx_scs_240_120_set1_mux2[6] = {0,1,2,3,0,1}; ...@@ -114,10 +114,6 @@ uint8_t nr_ss_first_symb_idx_scs_240_120_set1_mux2[6] = {0,1,2,3,0,1};
// Mux pattern type 3 // Mux pattern type 3
uint8_t nr_ss_first_symb_idx_scs_120_120_mux3[4] = {4,8,2,6}; uint8_t nr_ss_first_symb_idx_scs_120_120_mux3[4] = {4,8,2,6};
/// Search space max values indexed by scs
uint8_t nr_max_number_of_candidates_per_slot[4] = {44, 36, 22, 20};
uint8_t nr_max_number_of_cces_per_slot[4] = {56, 56, 48, 32};
// CQI TABLES (10 times the value in 214 to adequately compare with R) // CQI TABLES (10 times the value in 214 to adequately compare with R)
// Table 1 (38.214 5.2.2.1-2) // Table 1 (38.214 5.2.2.1-2)
uint16_t cqi_table1[16][2] = {{0,0},{2,780},{2,1200},{2,1930},{2,3080},{2,4490},{2,6020},{4,3780}, uint16_t cqi_table1[16][2] = {{0,0},{2,780},{2,1200},{2,1930},{2,3080},{2,4490},{2,6020},{4,3780},
...@@ -132,16 +128,6 @@ uint16_t cqi_table3[16][2] = {{0,0},{2,300},{2,500},{2,780},{2,1200},{2,1930},{2 ...@@ -132,16 +128,6 @@ uint16_t cqi_table3[16][2] = {{0,0},{2,300},{2,500},{2,780},{2,1200},{2,1930},{2
{2,6020},{4,3780},{4,4900},{4,6160},{6,4660},{6,5670},{6,6660},{6,7720}}; {2,6020},{4,3780},{4,4900},{4,6160},{6,4660},{6,5670},{6,6660},{6,7720}};
static inline uint8_t get_max_candidates(uint8_t scs) {
AssertFatal(scs<4, "Invalid PDCCH subcarrier spacing %d\n", scs);
return (nr_max_number_of_candidates_per_slot[scs]);
}
static inline uint8_t get_max_cces(uint8_t scs) {
AssertFatal(scs<4, "Invalid PDCCH subcarrier spacing %d\n", scs);
return (nr_max_number_of_cces_per_slot[scs]);
}
uint8_t get_dl_nrOfLayers(const NR_UE_sched_ctrl_t *sched_ctrl, uint8_t get_dl_nrOfLayers(const NR_UE_sched_ctrl_t *sched_ctrl,
const nr_dci_format_t dci_format) { const nr_dci_format_t dci_format) {
...@@ -431,16 +417,15 @@ NR_sched_pdcch_t set_pdcch_structure(gNB_MAC_INST *gNB_mac, ...@@ -431,16 +417,15 @@ NR_sched_pdcch_t set_pdcch_structure(gNB_MAC_INST *gNB_mac,
return pdcch; return pdcch;
} }
int find_pdcch_candidate(const gNB_MAC_INST *mac,
int find_pdcch_candidate(gNB_MAC_INST *mac,
int cc_id, int cc_id,
int aggregation, int aggregation,
int nr_of_candidates, int nr_of_candidates,
NR_sched_pdcch_t *pdcch, const NR_sched_pdcch_t *pdcch,
NR_ControlResourceSet_t *coreset, const NR_ControlResourceSet_t *coreset,
uint32_t Y){ uint32_t Y){
uint16_t *vrb_map = mac->common_channels[cc_id].vrb_map; const uint16_t *vrb_map = mac->common_channels[cc_id].vrb_map;
const int N_ci = 0; const int N_ci = 0;
const int N_rb = pdcch->n_rb; // nb of rbs of coreset per symbol const int N_rb = pdcch->n_rb; // nb of rbs of coreset per symbol
...@@ -475,6 +460,39 @@ int find_pdcch_candidate(gNB_MAC_INST *mac, ...@@ -475,6 +460,39 @@ int find_pdcch_candidate(gNB_MAC_INST *mac,
return -1; return -1;
} }
int get_cce_index(const gNB_MAC_INST *nrmac,
const int CC_id,
const int slot,
const rnti_t rnti,
uint8_t *aggregation_level,
const NR_SearchSpace_t *ss,
const NR_ControlResourceSet_t *coreset,
NR_sched_pdcch_t *sched_pdcch,
bool is_common)
{
const uint32_t Y = is_common ? 0 : get_Y(ss, slot, rnti);
uint8_t nr_of_candidates;
for (int i=0; i<5; i++) {
// for now taking the lowest value among the available aggregation levels
find_aggregation_candidates(aggregation_level,
&nr_of_candidates,
ss,
1<<i);
if(nr_of_candidates>0)
break;
}
int CCEIndex = find_pdcch_candidate(nrmac,
CC_id,
*aggregation_level,
nr_of_candidates,
sched_pdcch,
coreset,
Y);
return CCEIndex;
}
void fill_pdcch_vrb_map(gNB_MAC_INST *mac, void fill_pdcch_vrb_map(gNB_MAC_INST *mac,
int CC_id, int CC_id,
NR_sched_pdcch_t *pdcch, NR_sched_pdcch_t *pdcch,
......
...@@ -269,12 +269,12 @@ NR_sched_pdcch_t set_pdcch_structure(gNB_MAC_INST *gNB_mac, ...@@ -269,12 +269,12 @@ NR_sched_pdcch_t set_pdcch_structure(gNB_MAC_INST *gNB_mac,
NR_BWP_t *bwp, NR_BWP_t *bwp,
NR_Type0_PDCCH_CSS_config_t *type0_PDCCH_CSS_config); NR_Type0_PDCCH_CSS_config_t *type0_PDCCH_CSS_config);
int find_pdcch_candidate(gNB_MAC_INST *mac, int find_pdcch_candidate(const gNB_MAC_INST *mac,
int cc_id, int cc_id,
int aggregation, int aggregation,
int nr_of_candidates, int nr_of_candidates,
NR_sched_pdcch_t *pdcch, const NR_sched_pdcch_t *pdcch,
NR_ControlResourceSet_t *coreset, const NR_ControlResourceSet_t *coreset,
uint32_t Y); uint32_t Y);
void fill_pdcch_vrb_map(gNB_MAC_INST *mac, void fill_pdcch_vrb_map(gNB_MAC_INST *mac,
...@@ -473,7 +473,15 @@ void set_sched_pucch_list(NR_UE_sched_ctrl_t *sched_ctrl, ...@@ -473,7 +473,15 @@ void set_sched_pucch_list(NR_UE_sched_ctrl_t *sched_ctrl,
const int get_dl_tda(const gNB_MAC_INST *nrmac, const NR_ServingCellConfigCommon_t *scc, int slot); const int get_dl_tda(const gNB_MAC_INST *nrmac, const NR_ServingCellConfigCommon_t *scc, int slot);
const int get_ul_tda(const gNB_MAC_INST *nrmac, const NR_ServingCellConfigCommon_t *scc, int slot); const int get_ul_tda(const gNB_MAC_INST *nrmac, const NR_ServingCellConfigCommon_t *scc, int slot);
bool find_free_CCE(sub_frame_t slot, NR_UE_info_t *UE); int get_cce_index(const gNB_MAC_INST *nrmac,
const int CC_id,
const int slot,
const rnti_t rnti,
uint8_t *aggregation_level,
const NR_SearchSpace_t *ss,
const NR_ControlResourceSet_t *coreset,
NR_sched_pdcch_t *sched_pdcch,
bool is_common);
bool nr_find_nb_rb(uint16_t Qm, bool nr_find_nb_rb(uint16_t Qm,
uint16_t R, uint16_t R,
......
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