schedule SRS K2 slots in advance

This commit is contained in:
francescomani
2023-01-14 17:51:27 +01:00
parent 214aa50595
commit f9f6283cc3
4 changed files with 41 additions and 28 deletions
+1 -3
View File
@@ -216,9 +216,7 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
// Schedule CSI measurement reporting // Schedule CSI measurement reporting
nr_csi_meas_reporting(module_idP, frame, slot); nr_csi_meas_reporting(module_idP, frame, slot);
// Schedule SRS: check in slot 0 for the whole frame nr_schedule_srs(module_idP, frame, slot);
if (slot == 0)
nr_schedule_srs(module_idP, frame);
// This schedule RA procedure if not in phy_test mode // This schedule RA procedure if not in phy_test mode
// Otherwise consider 5G already connected // Otherwise consider 5G already connected
+24 -9
View File
@@ -222,7 +222,8 @@ void nr_fill_nfapi_srs(int module_id, int CC_id, NR_UE_info_t* UE, sub_frame_t s
* Only for periodic scheduling yet. * Only for periodic scheduling yet.
* *
*********************************************************************/ *********************************************************************/
void nr_schedule_srs(int module_id, frame_t frame) { void nr_schedule_srs(int module_id, frame_t frame, int slot)
{
gNB_MAC_INST *nrmac = RC.nrmac[module_id]; gNB_MAC_INST *nrmac = RC.nrmac[module_id];
NR_UEs_t *UE_info = &nrmac->UE_info; NR_UEs_t *UE_info = &nrmac->UE_info;
@@ -232,9 +233,11 @@ void nr_schedule_srs(int module_id, frame_t frame) {
NR_UE_sched_ctrl_t *sched_ctrl = &UE->UE_sched_ctrl; NR_UE_sched_ctrl_t *sched_ctrl = &UE->UE_sched_ctrl;
NR_UE_UL_BWP_t *current_BWP = &UE->current_UL_BWP; NR_UE_UL_BWP_t *current_BWP = &UE->current_UL_BWP;
if(sched_ctrl->sched_srs.srs_scheduled && sched_ctrl->sched_srs.frame == frame && sched_ctrl->sched_srs.slot == slot) {
sched_ctrl->sched_srs.frame = -1; sched_ctrl->sched_srs.frame = -1;
sched_ctrl->sched_srs.slot = -1; sched_ctrl->sched_srs.slot = -1;
sched_ctrl->sched_srs.srs_scheduled = false; sched_ctrl->sched_srs.srs_scheduled = false;
}
if((sched_ctrl->ul_failure == 1 && get_softmodem_params()->phy_test==0) || if((sched_ctrl->ul_failure == 1 && get_softmodem_params()->phy_test==0) ||
sched_ctrl->rrc_processing_timer > 0) { sched_ctrl->rrc_processing_timer > 0) {
@@ -271,16 +274,28 @@ void nr_schedule_srs(int module_id, frame_t frame) {
continue; continue;
} }
uint16_t period = srs_period[srs_resource->resourceType.choice.periodic->periodicityAndOffset_p.present]; const int num_tda = current_BWP->tdaList->list.count;
uint16_t offset = get_nr_srs_offset(srs_resource->resourceType.choice.periodic->periodicityAndOffset_p); int max_k2 = 0;
int n_slots_frame = nr_slots_per_frame[current_BWP->scs]; // avoid last one in the list (for msg3)
for (int i = 0; i < num_tda - 1; i++) {
int k2 = get_K2(current_BWP->tdaList, i, current_BWP->scs);
max_k2 = k2 > max_k2 ? k2 : max_k2;
}
// we are sheduling SRS max_k2 slot in advance for the presence of SRS to be taken into account when scheduling PUSCH
const int n_slots_frame = nr_slots_per_frame[current_BWP->scs];
const int sched_slot = (slot + max_k2) % n_slots_frame;
const int sched_frame = (frame + ((slot + max_k2) / n_slots_frame)) % 1024;
const uint16_t period = srs_period[srs_resource->resourceType.choice.periodic->periodicityAndOffset_p.present];
const uint16_t offset = get_nr_srs_offset(srs_resource->resourceType.choice.periodic->periodicityAndOffset_p);
// Check if UE will transmit the SRS in this frame // Check if UE will transmit the SRS in this frame
if (((frame - offset / n_slots_frame) * n_slots_frame) % period == 0) { if ((sched_frame * n_slots_frame + sched_slot - offset) % period == 0) {
LOG_D(NR_MAC,"Scheduling SRS reception for %d.%d\n", frame, offset%n_slots_frame); LOG_D(NR_MAC," %d.%d Scheduling SRS reception for %d.%d\n", frame, slot, sched_frame, sched_slot);
nr_fill_nfapi_srs(module_id, CC_id, UE, offset%n_slots_frame, srs_resource_set, srs_resource); nr_fill_nfapi_srs(module_id, CC_id, UE, sched_slot, srs_resource_set, srs_resource);
sched_ctrl->sched_srs.frame = frame; sched_ctrl->sched_srs.frame = sched_frame;
sched_ctrl->sched_srs.slot = offset%n_slots_frame; sched_ctrl->sched_srs.slot = sched_slot;
sched_ctrl->sched_srs.srs_scheduled = true; sched_ctrl->sched_srs.srs_scheduled = true;
} }
} }
+1 -1
View File
@@ -199,7 +199,7 @@ void nr_srs_ri_computation(const nfapi_nr_srs_normalized_channel_iq_matrix_t *nr
const NR_UE_UL_BWP_t *current_BWP, const NR_UE_UL_BWP_t *current_BWP,
uint8_t *ul_ri); uint8_t *ul_ri);
void nr_schedule_srs(int module_id, frame_t frame); void nr_schedule_srs(int module_id, frame_t frame, int slot);
void nr_csirs_scheduling(int Mod_idP, void nr_csirs_scheduling(int Mod_idP,
frame_t frame, frame_t frame,