Schedule SRS longer in advance, cleanup
Schedule SRS longer in advance, so that it would also be enough even with big k2 for UL TDA. Remove useless types: we do not use the information on sched_srs anymore, so remove it. Check that the VRB map is free before making allocations.
This commit is contained in:
@@ -2766,8 +2766,6 @@ bool add_connected_nr_ue(gNB_MAC_INST *nr_mac, NR_UE_info_t *UE)
|
||||
|
||||
NR_UE_sched_ctrl_t *sched_ctrl = &UE->UE_sched_ctrl;
|
||||
sched_ctrl->dl_max_mcs = 28; /* do not limit MCS for individual UEs */
|
||||
sched_ctrl->sched_srs.frame = -1;
|
||||
sched_ctrl->sched_srs.slot = -1;
|
||||
sched_ctrl->pdcch_cl_adjust = 0;
|
||||
reset_srs_stats(UE);
|
||||
|
||||
|
||||
@@ -471,9 +471,13 @@ static void nr_configure_srs(gNB_MAC_INST *nrmac,
|
||||
NR_beam_alloc_t beam = beam_allocation_procedure(&nrmac->beam_info, frame, slot, UE->UE_beam_index, slots_per_frame);
|
||||
AssertFatal(beam.idx >= 0, "Cannot allocate SRS in any available beam\n");
|
||||
uint16_t *vrb_map_UL = &nrmac->common_channels[CC_id].vrb_map_UL[beam.idx][buffer_index * MAX_BWP_SIZE];
|
||||
uint64_t mask = SL_to_bitmap(srs_pdu->time_start_position, srs_pdu->num_symbols);
|
||||
for (int i = 0; i < srs_pdu->bwp_size; ++i)
|
||||
vrb_map_UL[i + srs_pdu->bwp_start] |= mask;
|
||||
uint16_t mask = SL_to_bitmap(srs_pdu->time_start_position, srs_pdu->num_symbols);
|
||||
for (int i = 0; i < srs_pdu->bwp_size; ++i) {
|
||||
int rb = i + srs_pdu->bwp_start;
|
||||
uint16_t alloc = vrb_map_UL[rb] & mask;
|
||||
AssertFatal(nrmac->ulprbbl[rb] != 0 || alloc == 0, "RB %d not free for SRS: alloc 0x%02x for mask 0x%02x\n", rb, alloc, mask);
|
||||
vrb_map_UL[rb] |= mask;
|
||||
}
|
||||
}
|
||||
|
||||
static void nr_fill_nfapi_srs(gNB_MAC_INST *nrmac,
|
||||
@@ -512,9 +516,7 @@ static void nr_fill_nfapi_srs(gNB_MAC_INST *nrmac,
|
||||
*********************************************************************/
|
||||
void nr_schedule_srs(int module_id, frame_t frame, int slot)
|
||||
{
|
||||
const int CC_id = 0;
|
||||
gNB_MAC_INST *nrmac = RC.nrmac[module_id];
|
||||
const NR_ServingCellConfigCommon_t *scc = nrmac->common_channels[CC_id].ServingCellConfigCommon;
|
||||
|
||||
/* already mutex protected: held in gNB_dlsch_ulsch_scheduler() */
|
||||
NR_SCHED_ENSURE_LOCKED(&nrmac->sched_lock);
|
||||
@@ -526,12 +528,6 @@ void nr_schedule_srs(int module_id, frame_t frame, int slot)
|
||||
NR_UE_sched_ctrl_t *sched_ctrl = &UE->UE_sched_ctrl;
|
||||
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.slot = -1;
|
||||
sched_ctrl->sched_srs.srs_scheduled = false;
|
||||
}
|
||||
|
||||
if ((sched_ctrl->ul_failure && !get_softmodem_params()->phy_test) || nr_timer_is_active(&sched_ctrl->transm_interrupt)) {
|
||||
continue;
|
||||
}
|
||||
@@ -566,34 +562,20 @@ void nr_schedule_srs(int module_id, frame_t frame, int slot)
|
||||
continue;
|
||||
}
|
||||
|
||||
NR_PUSCH_TimeDomainResourceAllocationList_t *tdaList = get_ul_tdalist(current_BWP,
|
||||
sched_ctrl->coreset->controlResourceSetId,
|
||||
sched_ctrl->search_space->searchSpaceType->present,
|
||||
TYPE_C_RNTI_);
|
||||
const int num_tda = tdaList->list.count;
|
||||
int max_k2 = 0;
|
||||
// avoid last one in the list (for msg3)
|
||||
for (int i = 0; i < num_tda - 1; i++) {
|
||||
int k2 = get_K2(tdaList, i, current_BWP->scs, scc);
|
||||
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 = nrmac->frame_structure.numb_slots_frame;
|
||||
const int sched_slot = (slot + max_k2) % n_slots_frame;
|
||||
const int sched_frame = (frame + (slot + max_k2) / n_slots_frame) % MAX_FRAME_NUMBER;
|
||||
const int n_ahead = n_slots_frame - 1 + get_NTN_Koffset(nrmac->common_channels[0].ServingCellConfigCommon);
|
||||
const int sched_slot = (slot + n_ahead) % n_slots_frame;
|
||||
const int sched_frame = (frame + (slot + n_ahead) / n_slots_frame) % MAX_FRAME_NUMBER;
|
||||
|
||||
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
|
||||
if ((sched_frame * n_slots_frame + sched_slot - offset) % period == 0) {
|
||||
LOG_D(NR_MAC," %d.%d Scheduling SRS reception for %d.%d\n", frame, slot, sched_frame, sched_slot);
|
||||
nr_fill_nfapi_srs(nrmac, CC_id, UE, sched_frame, sched_slot, srs_resource_set, srs_resource);
|
||||
sched_ctrl->sched_srs.frame = sched_frame;
|
||||
sched_ctrl->sched_srs.slot = sched_slot;
|
||||
sched_ctrl->sched_srs.srs_scheduled = true;
|
||||
}
|
||||
if ((sched_frame * n_slots_frame + sched_slot - offset) % period != 0)
|
||||
continue;
|
||||
LOG_D(NR_MAC," %d.%d Scheduling SRS reception for %d.%d\n", frame, slot, sched_frame, sched_slot);
|
||||
nr_fill_nfapi_srs(nrmac, CC_id, UE, sched_frame, sched_slot, srs_resource_set, srs_resource);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1585,25 +1585,6 @@ void handle_nr_srs_measurements(const module_id_t module_id,
|
||||
NR_SCHED_UNLOCK(&nrmac->sched_lock);
|
||||
}
|
||||
|
||||
long get_K2(NR_PUSCH_TimeDomainResourceAllocationList_t *tdaList,
|
||||
int time_domain_assignment,
|
||||
int mu,
|
||||
const NR_ServingCellConfigCommon_t *scc)
|
||||
{
|
||||
/* we assume that this function is mutex-protected from outside */
|
||||
NR_PUSCH_TimeDomainResourceAllocation_t *tda = tdaList->list.array[time_domain_assignment];
|
||||
const int NTN_gNB_Koffset = get_NTN_Koffset(scc);
|
||||
|
||||
if (tda->k2)
|
||||
return *tda->k2 + NTN_gNB_Koffset;
|
||||
else if (mu < 2)
|
||||
return 1 + NTN_gNB_Koffset;
|
||||
else if (mu == 2)
|
||||
return 2 + NTN_gNB_Koffset;
|
||||
else
|
||||
return 3 + NTN_gNB_Koffset;
|
||||
}
|
||||
|
||||
static bool nr_UE_is_to_be_scheduled(const frame_structure_t *fs,
|
||||
NR_UE_info_t *UE,
|
||||
frame_t frame,
|
||||
|
||||
@@ -286,11 +286,6 @@ NR_ControlResourceSet_t *get_coreset(gNB_MAC_INST *nrmac,
|
||||
NR_BWP_DownlinkDedicated_t *bwp_dedicated,
|
||||
NR_ControlResourceSetId_t coreset_id);
|
||||
|
||||
long get_K2(NR_PUSCH_TimeDomainResourceAllocationList_t *tdaList,
|
||||
int time_domain_assignment,
|
||||
int mu,
|
||||
const NR_ServingCellConfigCommon_t *scc);
|
||||
|
||||
const NR_DMRS_UplinkConfig_t *get_DMRS_UplinkConfig(const NR_PUSCH_Config_t *pusch_Config, const NR_tda_info_t *tda_info);
|
||||
|
||||
NR_pusch_dmrs_t get_ul_dmrs_params(const NR_ServingCellConfigCommon_t *scc,
|
||||
|
||||
@@ -429,12 +429,6 @@ typedef struct NR_sched_pusch {
|
||||
int phr_txpower_calc;
|
||||
} NR_sched_pusch_t;
|
||||
|
||||
typedef struct NR_sched_srs {
|
||||
int frame;
|
||||
int slot;
|
||||
bool srs_scheduled;
|
||||
} NR_sched_srs_t;
|
||||
|
||||
typedef struct NR_pdsch_dmrs {
|
||||
uint8_t dmrs_ports_id;
|
||||
uint8_t N_PRB_DMRS;
|
||||
@@ -599,9 +593,6 @@ typedef struct {
|
||||
NR_sched_pucch_t *sched_pucch;
|
||||
int sched_pucch_size;
|
||||
|
||||
/// Sched SRS: scheduling decisions
|
||||
NR_sched_srs_t sched_srs;
|
||||
|
||||
/// uplink bytes that are currently scheduled
|
||||
int sched_ul_bytes;
|
||||
/// estimation of the UL buffer size
|
||||
|
||||
Reference in New Issue
Block a user