Commit 5a2caa54 authored by Robert Schmidt's avatar Robert Schmidt

Refactor nr_csi_meas_reporting(): check only in slot 0

parent b6ebdc2f
...@@ -410,9 +410,9 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, ...@@ -410,9 +410,9 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
// This schedule SR // This schedule SR
// TODO // TODO
// This schedule CSI measurement reporting // Schedule CSI measurement reporting: check in slot 0 for the whole frame
if (UE_info->active[UE_id]) if (slot == 0 && UE_info->active[UE_id])
nr_csi_meas_reporting(module_idP, UE_id, frame, slot, num_slots_per_tdd, nr_ulmix_slots, nr_slots_per_frame[*scc->ssbSubcarrierSpacing]); nr_csi_meas_reporting(module_idP, UE_id, frame, slot);
// This schedule RA procedure if not in phy_test mode // This schedule RA procedure if not in phy_test mode
// Otherwise already consider 5G already connected // Otherwise already consider 5G already connected
......
...@@ -181,87 +181,74 @@ uint16_t nr_get_csi_bitlen(const nr_csi_report_t *csi_report) ...@@ -181,87 +181,74 @@ uint16_t nr_get_csi_bitlen(const nr_csi_report_t *csi_report)
void nr_csi_meas_reporting(int Mod_idP, void nr_csi_meas_reporting(int Mod_idP,
int UE_id, int UE_id,
frame_t frame, frame_t frame,
sub_frame_t slot, sub_frame_t slot)
int slots_per_tdd, {
int ul_slots,
int n_slots_frame) {
NR_UE_info_t *UE_info = &RC.nrmac[Mod_idP]->UE_info; NR_UE_info_t *UE_info = &RC.nrmac[Mod_idP]->UE_info;
NR_sched_pucch_t *curr_pucch; const NR_CellGroupConfig_t *secondaryCellGroup = UE_info->secondaryCellGroup[UE_id];
NR_PUCCH_ResourceSet_t *pucchresset; NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id];
NR_CSI_ReportConfig_t *csirep; const NR_CSI_MeasConfig_t *csi_measconfig = secondaryCellGroup->spCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup;
NR_CellGroupConfig_t *secondaryCellGroup = UE_info->secondaryCellGroup[UE_id]; AssertFatal(csi_measconfig->csi_ReportConfigToAddModList->list.count > 0,
NR_CSI_MeasConfig_t *csi_measconfig = secondaryCellGroup->spCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup; "NO CSI report configuration available");
NR_BWP_Uplink_t *ubwp=secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList->list.array[0]; NR_PUCCH_Config_t *pucch_Config = sched_ctrl->active_ubwp->bwp_Dedicated->pucch_Config->choice.setup;
NR_PUCCH_Config_t *pucch_Config = ubwp->bwp_Dedicated->pucch_Config->choice.setup;
AssertFatal(csi_measconfig->csi_ReportConfigToAddModList->list.count>0,"NO CSI report configuration available"); NR_ServingCellConfigCommon_t *scc =
RC.nrmac[Mod_idP]->common_channels->ServingCellConfigCommon;
const int n_slots_frame = nr_slots_per_frame[*scc->ssbSubcarrierSpacing];
for (int csi_report_id = 0; csi_report_id < csi_measconfig->csi_ReportConfigToAddModList->list.count; csi_report_id++){ for (int csi_report_id = 0; csi_report_id < csi_measconfig->csi_ReportConfigToAddModList->list.count; csi_report_id++){
const NR_CSI_ReportConfig_t *csirep = csi_measconfig->csi_ReportConfigToAddModList->list.array[csi_report_id];
csirep = csi_measconfig->csi_ReportConfigToAddModList->list.array[csi_report_id]; AssertFatal(csirep->reportConfigType.choice.periodic,
"Only periodic CSI reporting is implemented currently\n");
AssertFatal(csirep->reportConfigType.choice.periodic!=NULL,"Only periodic CSI reporting is implemented currently"); int period, offset;
int period, offset, sched_slot; csi_period_offset(csirep, &period, &offset);
csi_period_offset(csirep,&period,&offset); const int sched_slot = (period + offset) % n_slots_frame;
sched_slot = (period+offset)%n_slots_frame;
// prepare to schedule csi measurement reception according to 5.2.1.4 in 38.214 // prepare to schedule csi measurement reception according to 5.2.1.4 in 38.214
// preparation is done in first slot of tdd period // preparation is done in first slot of tdd period
if ( (frame%(period/n_slots_frame)==(offset/n_slots_frame)) && (slot==((sched_slot/slots_per_tdd)*slots_per_tdd))) { if (frame % (period / n_slots_frame) != offset / n_slots_frame)
continue;
// we are scheduling pucch for csi in the first pucch occasion (this comes before ack/nack) LOG_D(MAC, "CSI in frame %d slot %d\n", frame, sched_slot);
// FIXME: for the moment, we statically put it into the second sched_pucch!
curr_pucch = &UE_info->UE_sched_ctrl[UE_id].sched_pucch[2]; // we are scheduling pucch for csi in the first pucch occasion (this comes before ack/nack)
// FIXME: for the moment, we statically put it into the second sched_pucch!
NR_PUCCH_CSI_Resource_t *pucchcsires = csirep->reportConfigType.choice.periodic->pucch_CSI_ResourceList.list.array[0]; NR_sched_pucch_t *curr_pucch = &UE_info->UE_sched_ctrl[UE_id].sched_pucch[2];
int found = -1; const NR_PUCCH_CSI_Resource_t *pucchcsires = csirep->reportConfigType.choice.periodic->pucch_CSI_ResourceList.list.array[0];
pucchresset = pucch_Config->resourceSetToAddModList->list.array[1]; // set with formats >1 const NR_PUCCH_ResourceSet_t *pucchresset = pucch_Config->resourceSetToAddModList->list.array[1]; // set with formats >1
int n_list = pucchresset->resourceList.list.count; const int n = pucchresset->resourceList.list.count;
for (int i=0; i<n_list; i++) { int res_index = 0;
if (*pucchresset->resourceList.list.array[i] == pucchcsires->pucch_Resource) for (; res_index < n; res_index++)
found = i; if (*pucchresset->resourceList.list.array[res_index] == pucchcsires->pucch_Resource)
} break;
AssertFatal(found>-1,"CSI resource not found among PUCCH resources"); AssertFatal(res_index < n,
"CSI resource not found among PUCCH resources\n");
curr_pucch->resource_indicator = found; curr_pucch->resource_indicator = res_index;
n_list = pucch_Config->resourceToAddModList->list.count; // going through the list of PUCCH resources to find the one indexed by resource_id
const int m = pucch_Config->resourceToAddModList->list.count;
// going through the list of PUCCH resources to find the one indexed by resource_id for (int j = 0; j < m; j++) {
for (int i=0; i<n_list; i++) { NR_PUCCH_Resource_t *pucchres = pucch_Config->resourceToAddModList->list.array[j];
NR_PUCCH_Resource_t *pucchres = pucch_Config->resourceToAddModList->list.array[i]; if (pucchres->pucch_ResourceId != *pucchresset->resourceList.list.array[res_index])
if (pucchres->pucch_ResourceId == *pucchresset->resourceList.list.array[found]) { continue;
switch(pucchres->format.present){ switch(pucchres->format.present){
case NR_PUCCH_Resource__format_PR_format2: case NR_PUCCH_Resource__format_PR_format2:
if (pucch_Config->format2->choice.setup->simultaneousHARQ_ACK_CSI == NULL) curr_pucch->simultaneous_harqcsi = pucch_Config->format2->choice.setup->simultaneousHARQ_ACK_CSI;
curr_pucch->simultaneous_harqcsi = false; break;
else case NR_PUCCH_Resource__format_PR_format3:
curr_pucch->simultaneous_harqcsi = true; curr_pucch->simultaneous_harqcsi = pucch_Config->format3->choice.setup->simultaneousHARQ_ACK_CSI;
break; break;
case NR_PUCCH_Resource__format_PR_format3: case NR_PUCCH_Resource__format_PR_format4:
if (pucch_Config->format3->choice.setup->simultaneousHARQ_ACK_CSI == NULL) curr_pucch->simultaneous_harqcsi = pucch_Config->format4->choice.setup->simultaneousHARQ_ACK_CSI;
curr_pucch->simultaneous_harqcsi = false; break;
else default:
curr_pucch->simultaneous_harqcsi = true; AssertFatal(0, "Invalid PUCCH format type\n");
break;
case NR_PUCCH_Resource__format_PR_format4:
if (pucch_Config->format4->choice.setup->simultaneousHARQ_ACK_CSI == NULL)
curr_pucch->simultaneous_harqcsi = false;
else
curr_pucch->simultaneous_harqcsi = true;
break;
default:
AssertFatal(1==0,"Invalid PUCCH format type");
}
}
} }
curr_pucch->csi_bits +=
nr_get_csi_bitlen(&UE_info->csi_report_template[UE_id][csi_report_id]);
curr_pucch->frame = frame;
curr_pucch->ul_slot = sched_slot;
} }
curr_pucch->csi_bits +=
nr_get_csi_bitlen(&UE_info->csi_report_template[UE_id][csi_report_id]);
curr_pucch->frame = frame;
curr_pucch->ul_slot = sched_slot;
} }
} }
...@@ -479,7 +466,7 @@ bool nr_acknack_scheduling(int mod_id, ...@@ -479,7 +466,7 @@ bool nr_acknack_scheduling(int mod_id,
} }
void csi_period_offset(NR_CSI_ReportConfig_t *csirep, void csi_period_offset(const NR_CSI_ReportConfig_t *csirep,
int *period, int *offset) { int *period, int *offset) {
NR_CSI_ReportPeriodicityAndOffset_PR p_and_o = csirep->reportConfigType.choice.periodic->reportSlotConfig.present; NR_CSI_ReportPeriodicityAndOffset_PR p_and_o = csirep->reportConfigType.choice.periodic->reportSlotConfig.present;
......
...@@ -213,16 +213,13 @@ void nr_schedule_pucch(int Mod_idP, ...@@ -213,16 +213,13 @@ void nr_schedule_pucch(int Mod_idP,
frame_t frameP, frame_t frameP,
sub_frame_t slotP); sub_frame_t slotP);
void csi_period_offset(NR_CSI_ReportConfig_t *csirep, void csi_period_offset(const NR_CSI_ReportConfig_t *csirep,
int *period, int *offset); int *period, int *offset);
void nr_csi_meas_reporting(int Mod_idP, void nr_csi_meas_reporting(int Mod_idP,
int UE_id, int UE_id,
frame_t frameP, frame_t frameP,
sub_frame_t slotP, sub_frame_t slotP);
int slots_per_tdd,
int ul_slots,
int n_slots_frame);
bool nr_acknack_scheduling(int Mod_idP, bool nr_acknack_scheduling(int Mod_idP,
int UE_id, int UE_id,
......
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